ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCtrlStructureMapperTest Class Reference

Class ilCtrlStructureMapperTest. More...

+ Inheritance diagram for ilCtrlStructureMapperTest:
+ Collaboration diagram for ilCtrlStructureMapperTest:

Public Member Functions

 testStructureMapperWithEmptyArray ()
 
 testStructureMapperWithCommonStringArray ()
 
 testStructureMapperWithAssociativeStringArray ()
 
 testStructureMapperWithEmptyClassData ()
 
 testStructureMapperWithStructureArray ()
 
 testStructureMapperWithMissingReferenceLists ()
 
 testStructureMapperWithInvalidReferenceInList ()
 
 testStructureMapperReferenceListIndexesAfterInvalidReferenceIsRemoved ()
 
 testStructureMapperWithMixedArray ()
 

Detailed Description

Member Function Documentation

◆ testStructureMapperReferenceListIndexesAfterInvalidReferenceIsRemoved()

ilCtrlStructureMapperTest::testStructureMapperReferenceListIndexesAfterInvalidReferenceIsRemoved ( )

Definition at line 163 of file ilCtrlStructureMapperTest.php.

References ilCtrlStructureInterface\KEY_CLASS_CHILDREN, and ilCtrlStructureInterface\KEY_CLASS_PARENTS.

163  : void
164  {
165  $mapper = new ilCtrlStructureMapper([
166  'class1' => [
168  0 => 'class3',
169  1 => 'class2',
170  ],
171  ],
172  'class2' => [],
173  ]);
174 
175  $this->assertEquals(
176  [
177  'class1' => [
179  0 => 'class2',
180  ],
181  ],
182  'class2' => [
184  0 => 'class1',
185  ],
186  ],
187  ],
188  $mapper->getStructure()
189  );
190  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithAssociativeStringArray()

ilCtrlStructureMapperTest::testStructureMapperWithAssociativeStringArray ( )

Definition at line 30 of file ilCtrlStructureMapperTest.php.

30  : void
31  {
32  $mapper = new ilCtrlStructureMapper([
33  'key0' => 'entry0',
34  'key1' => 'entry1',
35  'key2' => 'entry2'
36  ]);
37 
38  $this->assertEmpty($mapper->getStructure());
39  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithCommonStringArray()

ilCtrlStructureMapperTest::testStructureMapperWithCommonStringArray ( )

Definition at line 22 of file ilCtrlStructureMapperTest.php.

22  : void
23  {
24  $expected_values = ['entry0', 'entry1', 'entry2'];
25  $mapper = new ilCtrlStructureMapper($expected_values);
26 
27  $this->assertEmpty($mapper->getStructure());
28  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithEmptyArray()

ilCtrlStructureMapperTest::testStructureMapperWithEmptyArray ( )

Definition at line 16 of file ilCtrlStructureMapperTest.php.

16  : void
17  {
18  $mapper = new ilCtrlStructureMapper([]);
19  $this->assertEmpty($mapper->getStructure());
20  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithEmptyClassData()

ilCtrlStructureMapperTest::testStructureMapperWithEmptyClassData ( )

Definition at line 41 of file ilCtrlStructureMapperTest.php.

41  : void
42  {
43  $expected_values = [
44  'key0' => [],
45  'key1' => [],
46  'key2' => []
47  ];
48 
49  $mapper = new ilCtrlStructureMapper($expected_values);
50 
51  $this->assertEquals(
52  $expected_values,
53  $mapper->getStructure()
54  );
55  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithInvalidReferenceInList()

ilCtrlStructureMapperTest::testStructureMapperWithInvalidReferenceInList ( )

Definition at line 143 of file ilCtrlStructureMapperTest.php.

References ilCtrlStructureInterface\KEY_CLASS_PARENTS.

143  : void
144  {
145  $mapper = new ilCtrlStructureMapper([
146  'class1' => [
148  'class2',
149  ],
150  ],
151  ]);
152 
153  $this->assertEquals(
154  [
155  'class1' => [
157  ]
158  ],
159  $mapper->getStructure()
160  );
161  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithMissingReferenceLists()

ilCtrlStructureMapperTest::testStructureMapperWithMissingReferenceLists ( )

Definition at line 104 of file ilCtrlStructureMapperTest.php.

References ilCtrlStructureInterface\KEY_CLASS_CHILDREN, and ilCtrlStructureInterface\KEY_CLASS_PARENTS.

104  : void
105  {
106  $mapper = new ilCtrlStructureMapper([
107  'class0' => [
109  'class1',
110  ],
111  ],
112  'class1' => [
114  'class2',
115  ],
116  ],
117  'class2' => []
118  ]);
119 
120  $this->assertEquals(
121  [
122  'class0' => [
124  'class1',
125  ],
126  ],
127  'class1' => [
129  'class2',
130  'class0',
131  ],
132  ],
133  'class2' => [
135  'class1',
136  ],
137  ]
138  ],
139  $mapper->getStructure()
140  );
141  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithMixedArray()

ilCtrlStructureMapperTest::testStructureMapperWithMixedArray ( )

Definition at line 192 of file ilCtrlStructureMapperTest.php.

References ilCtrlStructureInterface\KEY_CLASS_CHILDREN, and ilCtrlStructureInterface\KEY_CLASS_PARENTS.

192  : void
193  {
194  $mapper = new ilCtrlStructureMapper([
195  'class1' => [],
196  'class2' => false,
197  3 => [
199  'class1',
200  ],
201  ],
202  'class3' => [
204  'class1',
205  'class2',
206  ],
207  ],
208  'class4' => [
210  3
211  ],
212  ],
213  ]);
214 
215  $this->assertEquals(
216  [
217  'class1' => [
219  'class3',
220  ],
221  ],
222  'class3' => [
224  'class1',
225  ],
226  ],
227  'class4' => [
229  ],
230  ],
231  $mapper->getStructure()
232  );
233  }
Class ilCtrlStructureMapper.

◆ testStructureMapperWithStructureArray()

ilCtrlStructureMapperTest::testStructureMapperWithStructureArray ( )

Definition at line 57 of file ilCtrlStructureMapperTest.php.

References ilCtrlStructureInterface\KEY_CLASS_CHILDREN, and ilCtrlStructureInterface\KEY_CLASS_PARENTS.

57  : void
58  {
59  $mapper = new ilCtrlStructureMapper([
60  'class0' => [
62  'class1',
63  ],
65  ],
66  'class1' => [
69  'class2',
70  ],
71  ],
72  'class2' => [
75  ]
76  ]);
77 
78  $this->assertEquals(
79  [
80  'class0' => [
82  'class1',
83  ],
85  ],
86  'class1' => [
89  'class2',
90  'class0',
91  ],
92  ],
93  'class2' => [
95  'class1',
96  ],
98  ]
99  ],
100  $mapper->getStructure()
101  );
102  }
Class ilCtrlStructureMapper.

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