예제 #1
0
파일: FrontTest.php 프로젝트: stunti/zf2
 public function testShouldAllowRetrievingCurrentModuleDirectory()
 {
     $this->testAddModuleDirectory();
     $request = new Request\HTTP();
     $request->setModuleName('bar');
     $this->_controller->setRequest($request);
     $dir = $this->_controller->getModuleDirectory();
     $this->assertContains('modules' . DIRECTORY_SEPARATOR . 'bar', $dir);
     $this->assertNotContains('controllers', $dir);
 }
예제 #2
0
 public function testHelperPullsResponseFromFrontControllerWithNoRegisteredActionController()
 {
     $helper = HelperBroker\HelperBroker::getStaticHelper('viewRenderer');
     $this->assertNull($helper->getActionController());
     $aRequest = new Request\HTTP();
     $aRequest->setModuleName('default')->setControllerName('zend_controller_action_helper-broker')->setActionName('index');
     $aResponse = new Response\Cli();
     $fRequest = new Request\HTTP();
     $fRequest->setModuleName('foo')->setControllerName('foo-bar')->setActionName('baz');
     $fResponse = new Response\Cli();
     $this->front->setRequest($fRequest)->setResponse($fResponse);
     $hRequest = $helper->getRequest();
     $this->assertNotSame($hRequest, $aRequest);
     $this->assertSame($hRequest, $fRequest);
     $hResponse = $helper->getResponse();
     $this->assertNotSame($hResponse, $aResponse);
     $this->assertSame($hResponse, $fResponse);
 }
예제 #3
0
파일: StandardTest.php 프로젝트: stunti/zf2
 /**
  * @see ZF-2693
  */
 public function testForcingCamelCasedActionsNotRequestedWithWordSeparatorsShouldRaiseNotices()
 {
     $this->_dispatcher->setParam('useCaseSensitiveActions', true);
     $request = new Request\HTTP();
     $request->setModuleName('admin');
     $request->setControllerName('foo-bar');
     $request->setActionName('bazBat');
     $this->assertTrue($this->_dispatcher->isDispatchable($request), var_export($this->_dispatcher->getControllerDirectory(), 1));
     $response = new Response\Cli();
     set_error_handler(array($this, 'handleErrors'));
     try {
         $this->_dispatcher->dispatch($request, $response);
         $body = $this->_dispatcher->getResponse()->getBody();
         restore_error_handler();
         $this->assertTrue(isset($this->error));
         $this->assertContains('deprecated', $this->error);
     } catch (Controller\Exception $e) {
         restore_error_handler();
         $this->fail('camelCased actions should succeed when forced');
     }
 }