61 $instances[] = $this->
getNew( $elementInstances[0] );
64 return $this->arrayWrap( $instances );
77 return new $class( $elements );
90 $arrayObject = $this->
getNew( $elements );
92 $this->assertEquals(
count( $elements ), $arrayObject->count() );
105 $arrayObject = $this->
getNew( $elements );
107 $this->assertEquals( $elements === [], $arrayObject->isEmpty() );
121 $this->assertTrue(
true );
123 $offset = $list->getIterator()->key();
124 $count = $list->count();
125 $list->offsetUnset( $offset );
126 $this->assertEquals( $count - 1, $list->count() );
130 $offset = $list->getIterator()->key();
131 $count = $list->count();
132 unset( $list[$offset] );
133 $this->assertEquals( $count - 1, $list->count() );
149 $listSize =
count( $elements );
151 foreach ( $elements
as $element ) {
152 $list->append( $element );
155 $this->assertEquals( $listSize, $list->count() );
159 foreach ( $elements
as $element ) {
163 $this->assertEquals( $listSize, $list->count() );
166 $list->
append( $element );
181 $elementClass = $list->getObjectType();
183 foreach ( [ 42,
'foo', [],
new stdClass(), 4.2 ]
as $element ) {
184 $validValid = $element instanceof $elementClass;
187 call_user_func( $function, $list, $element );
189 }
catch ( InvalidArgumentException $exception ) {
196 'Object of invalid type got successfully added to a GenericArrayObject'
211 if ( $elements === [] ) {
212 $this->assertTrue(
true );
219 $element = reset( $elements );
220 $list->offsetSet( 42, $element );
221 $this->assertEquals( $element, $list->offsetGet( 42 ) );
225 $element = reset( $elements );
226 $list[
'oHai'] = $element;
227 $this->assertEquals( $element, $list[
'oHai'] );
231 $element = reset( $elements );
232 $list->offsetSet( 9001, $element );
233 $this->assertEquals( $element, $list[9001] );
237 $element = reset( $elements );
238 $list->offsetSet(
null, $element );
239 $this->assertEquals( $element, $list[0] );
244 foreach ( $elements
as $element ) {
245 $list->offsetSet(
null, $element );
246 $this->assertEquals( $element, $list[$offset++] );
249 $this->assertEquals(
count( $elements ), $list->count() );
271 $this->assertEquals( $serialization,
serialize( $copy ) );
272 $this->assertEquals(
count( $list ),
count( $copy ) );
274 $list = $list->getArrayCopy();
275 $copy = $copy->getArrayCopy();
277 $this->assertArrayEquals( $list, $copy,
true,
true );