示例#1
0
 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());
 }
示例#2
0
 /**
  * Register a new filter.
  *
  * @param  Closure  $filter
  * @return void
  */
 public function addFilter($filter)
 {
     $this->filters->addFilter($filter);
 }