ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Structure\Definitions\LOMReaderTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\Structure\Definitions\LOMReaderTest:
+ Collaboration diagram for ILIAS\MetaData\Structure\Definitions\LOMReaderTest:

Public Member Functions

 testGetDefinition ()
 
 testSubDefinitions ()
 

Protected Member Functions

 getInitialReader ()
 

Detailed Description

Definition at line 26 of file LOMReaderTest.php.

Member Function Documentation

◆ getInitialReader()

ILIAS\MetaData\Structure\Definitions\LOMReaderTest::getInitialReader ( )
protected

Definition at line 28 of file LOMReaderTest.php.

28 : LOMReader
29 {
30 $initial_array = [
31 'name' => 'root',
32 'unique' => true,
33 'type' => Type::NULL,
34 'sub' => [
35 [
36 'name' => 'sub string',
37 'unique' => false,
38 'type' => Type::STRING,
39 'sub' => []
40 ],
41 [
42 'name' => 'sub language',
43 'unique' => true,
44 'type' => Type::LANG,
45 'sub' => [
46 [
47 'name' => 'sub sub duration',
48 'unique' => false,
49 'type' => Type::DURATION,
50 'sub' => []
51 ]
52 ]
53 ]
54 ]
55 ];
56 return new class ($initial_array) extends LOMReader {
57 public function __construct(protected array $initial_array)
58 {
60 }
61
62 protected function getDefinitionArray(): array
63 {
64 return $this->initial_array;
65 }
66 };
67 }
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\__construct(), ILIAS\GlobalScreen\Provider\__construct(), ILIAS\MetaData\Elements\Data\DURATION, and ILIAS\Data\Description\NULL.

Referenced by ILIAS\MetaData\Structure\Definitions\LOMReaderTest\testGetDefinition(), and ILIAS\MetaData\Structure\Definitions\LOMReaderTest\testSubDefinitions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testGetDefinition()

ILIAS\MetaData\Structure\Definitions\LOMReaderTest::testGetDefinition ( )

Definition at line 69 of file LOMReaderTest.php.

69 : void
70 {
71 $reader = $this->getInitialReader();
72 $definition = $reader->definition();
73 $this->assertSame(
74 'root',
75 $definition->name()
76 );
77 $this->assertSame(
79 $definition->dataType()
80 );
81 $this->assertTrue($definition->unique());
82 }

References ILIAS\MetaData\Structure\Definitions\LOMReaderTest\getInitialReader(), and ILIAS\Data\Description\NULL.

+ Here is the call graph for this function:

◆ testSubDefinitions()

ILIAS\MetaData\Structure\Definitions\LOMReaderTest::testSubDefinitions ( )

Definition at line 84 of file LOMReaderTest.php.

84 : void
85 {
86 $sub_readers = $this->getInitialReader()->subDefinitions();
87 $first_reader = $sub_readers->current();
88 $sub_readers->next();
89 $second_reader = $sub_readers->current();
90 $sub_readers->next();
91 $third_reader = $sub_readers->current();
92
93 $definition = $first_reader->definition();
94 $this->assertSame(
95 'sub string',
96 $definition->name()
97 );
98 $this->assertSame(
99 Type::STRING,
100 $definition->dataType()
101 );
102 $this->assertFalse($definition->unique());
103
104 $definition = $second_reader->definition();
105 $this->assertSame(
106 'sub language',
107 $definition->name()
108 );
109 $this->assertSame(
110 Type::LANG,
111 $definition->dataType()
112 );
113 $this->assertTrue($definition->unique());
114
115 $this->assertNull($third_reader);
116 $this->assertNull($first_reader->subDefinitions()->current());
117 $this->assertInstanceOf(
118 LOMReader::class,
119 $second_reader->subDefinitions()->current()
120 );
121 }

References ILIAS\MetaData\Structure\Definitions\LOMReaderTest\getInitialReader().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: