ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ExamplesYamlParserTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
25 {
26  protected Crawler\EntriesYamlParser $parser;
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  }
57 EOT;
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
78 EOT;
79  $this->assertEquals([], $this->parser->_getYamlEntriesFromString($doc));
80  }
81 
82 
83 }
Crawler EntriesYamlParser $parser