Beispiel #1
0
 /**
  * @expectedException	InvalidArgumentException
  * @dataProvider		provideInvalidStringsIncludeNull
  * @depends				testInterface
  * @return				null
  */
 public function testAddAclRoleCodeInvalidString($code)
 {
     $this->context->addAclCode($code);
 }
 /**
  * Now we will replace the context with a new context and break the chain
  * @return null
  */
 public function testApplyFiltersChainReplaceContextBreakChain()
 {
     $input = $this->getMock('Appfuel\\Kernel\\Mvc\\AppInputInterface');
     $detail = $this->getMock('Appfuel\\Kernel\\Mvc\\MvcRouteDetailInterface');
     $context = new MvcContext('html', 'my-route', $detail, $input);
     $replaceContext = new MvcContext('json', 'new-route', $detail, $input);
     $cback1 = function ($myContext, $builder) {
         $myContext->add('filter1', 'filter-result-1');
     };
     $filter1 = new InterceptFilter($cback1);
     $cback2 = function ($myContext, $builder) use($replaceContext) {
         $replaceContext->add('filter2', 'filter-result-2');
         return array('is-break-chain' => true, 'replace-context' => $replaceContext);
     };
     $filter2 = new InterceptFilter($cback2);
     $cback3 = function ($myContext, $builder) {
         $myContext->add('filter3', 'filter-result-3');
     };
     $filter3 = new InterceptFilter($cback3);
     $this->chain->setFilters(array($filter1, $filter2, $filter3));
     $result = $this->chain->applyFilters($context);
     $this->assertNotSame($context, $result);
     $this->assertSame($replaceContext, $result);
     $this->assertNull($replaceContext->get('filter1'));
     $this->assertEquals('filter-result-2', $replaceContext->get('filter2'));
     $this->assertNull($replaceContext->get('filter3'));
 }