1111
1212use Lunr \Halo \LunrBaseTest ;
1313use PHPDraft \Model \Elements \ArrayStructureElement ;
14+ use PHPDraft \Model \Elements \ElementStructureElement ;
1415
1516/**
1617 * Class ArrayStructureTest
@@ -58,7 +59,13 @@ public function parseObjectProvider(): array
5859 $ return = [];
5960 $ base1 = new ArrayStructureElement ();
6061 $ base1 ->key = null ;
61- $ base1 ->value = [['Swift ' => 'string ' ], ['Objective-C ' => 'string ' ]];
62+ $ val1 = new ElementStructureElement ();
63+ $ val1 ->value = 'Swift ' ;
64+ $ val1 ->type = 'string ' ;
65+ $ val2 = new ElementStructureElement ();
66+ $ val2 ->value = 'Objective-C ' ;
67+ $ val2 ->type = 'string ' ;
68+ $ base1 ->value = [$ val1 , $ val2 ];
6269 $ base1 ->status = null ;
6370 $ base1 ->element = 'array ' ;
6471 $ base1 ->type = null ;
@@ -68,7 +75,13 @@ public function parseObjectProvider(): array
6875
6976 $ base2 = new ArrayStructureElement ();
7077 $ base2 ->key = null ;
71- $ base2 ->value = [['item ' => 'string ' ], ['another item ' => 'string ' ]];
78+ $ val1 = new ElementStructureElement ();
79+ $ val1 ->value = 'item ' ;
80+ $ val1 ->type = 'string ' ;
81+ $ val2 = new ElementStructureElement ();
82+ $ val2 ->value = 'another item ' ;
83+ $ val2 ->type = 'string ' ;
84+ $ base2 ->value = [$ val1 , $ val2 ];
7285 $ base2 ->status = null ;
7386 $ base2 ->element = 'array ' ;
7487 $ base2 ->type = 'Some simple array ' ;
@@ -77,8 +90,16 @@ public function parseObjectProvider(): array
7790 $ base2 ->deps = ['Some simple array ' ];
7891
7992 $ base3 = new ArrayStructureElement ();
80- $ base3 ->key = 'car_id_list ' ;
81- $ base3 ->value = [['car_id_list ' => 'string ' ], ['' => 'array ' ]];
93+ $ base3 ->key = new ElementStructureElement ();
94+ $ base3 ->key ->value = 'car_id_list ' ;
95+ $ base3 ->key ->type = 'string ' ;
96+ $ val1 = new ElementStructureElement ();
97+ $ val1 ->value = 'car_id_list ' ;
98+ $ val1 ->type = 'string ' ;
99+ $ val2 = new ElementStructureElement ();
100+ $ val2 ->value = null ;
101+ $ val2 ->type = 'array ' ;
102+ $ base3 ->value = [$ val1 , $ val2 ];
82103 $ base3 ->status = 'optional ' ;
83104 $ base3 ->element = 'member ' ;
84105 $ base3 ->type = 'array ' ;
@@ -167,18 +188,32 @@ public function testNewInstance(): void
167188 */
168189 public function testToStringWithArray (): void
169190 {
170- $ this ->class ->value = [['string ' => 'stuff ' ], ['int ' => 'class ' ]];
191+ $ val1 = new ElementStructureElement ();
192+ $ val1 ->type = 'string ' ;
193+ $ val1 ->value = 'stuff ' ;
194+ $ val2 = new ElementStructureElement ();
195+ $ val2 ->type = 'int ' ;
196+ $ val2 ->value = 'class ' ;
197+ $ val2 ->description = 'Description ' ;
198+ $ this ->class ->value = [$ val1 , $ val2 ];
171199 $ return = $ this ->class ->__toString ();
172- $ this ->assertSame ('<ul class="list-group mdl-list"><li class="list-group-item mdl-list__item"><a class=" code" title="stuff" href="#object-stuff">stuff</a > - <span class="example-value pull-right">string </span></li><li class="list-group-item mdl-list__item"><a class="code" title="class " href="#object-class">class </a> - <span class="example-value pull-right">int </span></li></ul> ' , $ return );
200+ $ this ->assertSame ('<ul class="list-group mdl-list"><li class="list-group-item mdl-list__item"><code>string</code > - <span class="example-value pull-right">stuff </span></li><li class="list-group-item mdl-list__item"><a class="code" title="int " href="#object-int">int </a> - <span class="description">Description</span> - <span class=" example-value pull-right">class </span></li></ul> ' , $ return );
173201 }
174202
175203 /**
176204 * Test setup of new instances
177205 */
178206 public function testToStringWithComplexArray (): void
179207 {
180- $ this ->class ->value = [['type ' => 'Bike ' ], ['stuff ' => 'car ' ]];
208+ $ val1 = new ElementStructureElement ();
209+ $ val1 ->type = 'Bike ' ;
210+ $ val1 ->value = 'type ' ;
211+ $ val2 = new ElementStructureElement ();
212+ $ val2 ->type = 'car ' ;
213+ $ val2 ->value = 'stuff ' ;
214+ $ val2 ->description = 'Description ' ;
215+ $ this ->class ->value = [$ val1 , $ val2 ];
181216 $ return = $ this ->class ->__toString ();
182- $ this ->assertSame ('<ul class="list-group mdl-list"><li class="list-group-item mdl-list__item"><a class="code" title="Bike" href="#object-bike">Bike</a> - <span class="example-value pull-right">type</span></li><li class="list-group-item mdl-list__item"><a class="code" title="car" href="#object-car">car</a> - <span class="example-value pull-right">stuff</span></li></ul> ' , $ return );
217+ $ this ->assertSame ('<ul class="list-group mdl-list"><li class="list-group-item mdl-list__item"><a class="code" title="Bike" href="#object-bike">Bike</a> - <span class="example-value pull-right">type</span></li><li class="list-group-item mdl-list__item"><a class="code" title="car" href="#object-car">car</a> - <span class="description">Description</span> - <span class=" example-value pull-right">stuff</span></li></ul> ' , $ return );
183218 }
184219}
0 commit comments