123 $this->assertTrue(
true );
125 $offset = $list->getIterator()->key();
126 $count = $list->count();
127 $list->offsetUnset( $offset );
128 $this->assertEquals( $count - 1, $list->count() );
132 $offset = $list->getIterator()->key();
133 $count = $list->count();
134 unset( $list[$offset] );
135 $this->assertEquals( $count - 1, $list->count() );
151 $listSize = count( $elements );
153 foreach ( $elements as $element ) {
154 $list->append( $element );
157 $this->assertEquals( $listSize, $list->count() );
161 foreach ( $elements as $element ) {
165 $this->assertEquals( $listSize, $list->count() );
168 $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 );