writeFixture(<<foo
", $examples[0]['html']);
}
public function testSectionTracking()
{
$reader = $this->writeFixture(<<
b
`````````` SPEC); $examples = iterator_to_array($reader->examples(), false); $this->assertCount(2, $examples); $this->assertSame(1, $examples[0]['number']); $this->assertSame('Section One', $examples[0]['section']); $this->assertSame(2, $examples[1]['number']); $this->assertSame('Section Two', $examples[1]['section']); } public function testExampleWithExtensionLabel() { $reader = $this->writeFixture(<<line four
`````````` SPEC); $examples = iterator_to_array($reader->examples(), false); $this->assertSame( "line one\nline two\n\nline four", $examples[0]['markdown'] ); $this->assertSame( "line one\nline two
\nline four
", $examples[0]['html'] ); } public function testBackticksInsideExampleAreNotConfusedForFence() { // Opening fence is 14 backticks; a shorter run inside must not close. $reader = $this->writeFixture(<<code with backticks
``````````````
SPEC);
$examples = iterator_to_array($reader->examples(), false);
$this->assertCount(1, $examples);
$this->assertStringContainsString('`code`', $examples[0]['markdown']);
}
public function testNumbersAreSequential()
{
$body = '';
for ($i = 1; $i <= 5; $i++) {
$body .= "`````````` example\nmd$i\n.\nhtml$i\n``````````\n\n";
}
$reader = $this->writeFixture($body);
$examples = iterator_to_array($reader->examples(), false);
$this->assertCount(5, $examples);
foreach ($examples as $i => $ex) {
$this->assertSame($i + 1, $ex['number']);
}
}
public function testUnclosedFenceThrows()
{
$reader = $this->writeFixture(<<