/** * While loadFilter appends to the list, setFilters replaces the list * with the one passed in * * @depends testLoadFilters * @return null */ public function testSetFilters() { $list1 = array($this->getMock($this->filterInterface), $this->getMock($this->filterInterface), $this->getMock($this->filterInterface)); $this->chain->loadFilters($list1); $this->assertTrue($this->chain->isFilters()); $list2 = array($this->getMock($this->filterInterface), $this->getMock($this->filterInterface), $this->getMock($this->filterInterface)); $this->assertNotEquals($list1, $list2); $this->assertSame($this->chain, $this->chain->setFilters($list2)); $this->assertTrue($this->chain->isFilters()); $this->assertEquals($list2, $this->chain->getFilters()); }
/** * @param MvcActionDispatcherInterface $dispatch, * @param FilterManagerInterface $filterManager, * @param OutputInterface $output * @return MvcFront */ public function buildFront(MvcDispatcherInterface $dispatcher = null, InterceptChainInterface $preChain = null, InterceptChainInterface $postChain = null) { $preList = KernelRegistry::getParam('pre-filters', array()); if (null === $preChain) { $preChain = new InterceptChain(); } if (is_array($preList) && !empty($preList)) { $preChain->loadFilters($preList); } $postList = KernelRegistry::getParam('post-filters', array()); if (null === $postChain) { $postChain = new InterceptChain(); } if (is_array($postList) && !empty($postList)) { $postChain->loadFilters($postList); } if (null === $dispatcher) { $dispatcher = new MvcDispatcher(); } return new MvcFront($dispatcher, $preChain, $postChain); }