ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
StandardTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
29 
30 class StandardTest extends TestCase
31 {
32  protected function getReader(): Standard
33  {
34  $structurally_coupled = new class () extends NullReader {
35  public function read(\SimpleXMLElement $xml, Version $version): SetInterface
36  {
37  return new class ($xml, $version) extends NullSet {
38  public string $exposed;
39 
40  public function __construct(\SimpleXMLElement $xml, Version $version)
41  {
42  $this->exposed = 'generated by StructurallyCoupled in version ' .
43  $version->value . ' from xml ' . $xml->asXML();
44  }
45  };
46  }
47  };
48 
49  $legacy = new class () extends NullReader {
50  public function read(\SimpleXMLElement $xml, Version $version): SetInterface
51  {
52  return new class ($xml, $version) extends NullSet {
53  public string $exposed;
54 
55  public function __construct(\SimpleXMLElement $xml, Version $version)
56  {
57  $this->exposed = 'generated by Legacy in version ' .
58  $version->value . ' from xml ' . $xml->asXML();
59  }
60  };
61  }
62  };
63 
64  return new Standard($structurally_coupled, $legacy);
65  }
66 
67  public function testReadWithVersion10_0(): void
68  {
69  $xml = new SimpleXMLElement('<some>xml</some>');
70  $reader = $this->getReader();
71 
72  $set = $reader->read($xml, Version::V10_0);
73 
74  $this->assertSame(
75  'generated by StructurallyCoupled in version 10.0 from xml ' . $xml->asXML(),
76  $set->exposed
77  );
78  }
79 
80  public function testReadWithVersion4_1_0(): void
81  {
82  $xml = new SimpleXMLElement('<some>xml</some>');
83  $reader = $this->getReader();
84 
85  $set = $reader->read($xml, Version::V4_1_0);
86 
87  $this->assertSame(
88  'generated by Legacy in version 4.1.0 from xml ' . $xml->asXML(),
89  $set->exposed
90  );
91  }
92 }
$version
Definition: plugin.php:24
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76