ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ExamplesYamlParserTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use PHPUnit\Framework\TestCase;
23
24class ExamplesYamlParserTest extends TestCase
25{
27
28 protected function setUp(): void
29 {
30 $this->parser = new class () extends Crawler\ExamplesYamlParser {
31 public function _getYamlEntriesFromString(string $content): array
32 {
33 return $this->getYamlEntriesFromString($content);
34 }
35 };
36 }
37
38 public function testProperEntry(): void
39 {
40 $doc = <<<EOT
41 some other code here
42
54 function something()
55 {
56 }
57EOT;
58 $expected = [
59 'description' => "\nExample showing...",
60 'expected output' => "\nILIAS shows the expected output.\nAt least, it should."
61 ];
62
63 $this->assertEquals(
64 $expected,
65 $this->parser->_getYamlEntriesFromString($doc)
66 );
67
68 }
69
70 public function testMissingBoundaries(): void
71 {
72 $doc = <<<EOT
78EOT;
79 $this->assertEquals([], $this->parser->_getYamlEntriesFromString($doc));
80 }
81
82
83}
Crawler EntriesYamlParser $parser