public function testFilterItems() { $filters = new Menu\FilterRepository(); $item = new Menu\Items\Item($filters); $filters->addFilter(function ($item) { }); $filters->addFilter(function ($item) { $item->remove(); }, 'bar'); $this->assertTrue($item->exists()); $filters->filter($item); $this->assertTrue($item->exists()); $filters->filter($item, 'bar'); $this->assertFalse($item->exists()); }
/** * Register a new filter. * * @param Closure $filter * @return void */ public function addFilter($filter) { $this->filters->addFilter($filter); }