/** * @dataProvider getTestCollectionData */ public function testSetValueOnNullKey($item) { $collection = new Collection($item); /** @var $collection Collection */ $this->assertEquals(2, $collection->count()); $collection[] = 'foo'; $this->assertEquals(3, $collection->count()); // test finding next free numeric key $collection[] = 'foo'; $this->assertEquals(4, $collection->count()); }
/** * Gets the size of the collection by returning length for arrays or number of enumerable properties for objects. * * @param Collection $collection * @return int */ public function __invoke(Collection $collection) { return $collection->count(); }