/** * Test filtering collection elements * * @return void */ public function testFilter() { $filtered = $this->collection->filter(function ($value, $key) { return is_string($key); }); $this->assertAttributeNotEmpty('elements', $filtered); $this->assertAttributeCount(2, 'elements', $filtered); }
/** * Test each method breaks when receiving false from callback * * @return void */ public function testEachWithEarlyReturn() { $success = $this->collection->each(function ($key, $value) { return $key === 1; }); $this->assertFalse($success); }
/** * CandyCanePlantCollection constructor * * @param array $elements */ public function __construct(array $elements = []) { $this->breederService = new CandyCanePlantBreederService(); parent::__construct($elements); }
/** * Return queue count * * @return int */ public function count() { return $this->queue->count(); }
/** * Test collection empty method * * @return void */ public function testIsEmpty() { $this->assertFalse($this->collection->isEmpty()); $this->collection->clear(); $this->assertTrue($this->collection->isEmpty()); }