/** * Test offset unset method removes elements from collection * * @return void */ public function testOffsetUnset() { $this->assertTrue($this->collection->offsetExists(2)); $this->assertAttributeCount(5, 'elements', $this->collection); $this->collection->offsetUnset(2); $this->assertFalse($this->collection->offsetExists(2)); $this->assertAttributeCount(4, 'elements', $this->collection); }
/** * Test collection rewind * * @depends testKey * @depends testCurrent * @return void */ public function testRewind() { $this->collection->last(); $this->assertEquals('b', $this->collection->key()); $this->assertEquals(5, $this->collection->current()); $this->collection->rewind(); $this->assertEquals(0, $this->collection->key()); $this->assertEquals(1, $this->collection->current()); }
/** * Test converting back to array * * @return void */ public function testToArray() { $collection = new BaseCollection([1, 2, 3, 'a' => 4, 'b' => 5]); $this->assertEquals([1, 2, 3, 'a' => 4, 'b' => 5], $collection->toArray()); }
/** * Test invalid offset seek exception * * @expectedException \InvalidArgumentException * @return void */ public function testSeekException() { $this->collection->seek('noop'); }
/** * Test collection count method * * @return void */ public function testCount() { $this->assertEquals(5, $this->collection->count()); }