Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: weierophinney/zf2
...
head fork: weierophinney/zf2
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on May 17, 2012
@weierophinney [zen-33] Tests for all 404 conditions
- Use the ControllerLoader in order to set factories and invokable classes
56b50f2
Showing with 12 additions and 9 deletions.
  1. +12 −9 tests/Zend/Mvc/ApplicationTest.php
View
21 tests/Zend/Mvc/ApplicationTest.php
@@ -58,6 +58,7 @@ public function setUp()
);
$config = function($s) {
return new Config(array(
+ /*
'controller' => array(
'classes' => array(
'bad' => 'ZendTest\Mvc\Controller\TestAsset\BadController',
@@ -65,6 +66,7 @@ public function setUp()
'sample' => 'ZendTest\Mvc\Controller\TestAsset\SampleController',
),
),
+ */
));
};
$sm = $this->serviceManager = new ServiceManager(
@@ -229,7 +231,8 @@ public function setupPathController($addService = true)
$router->addRoute('path', $route);
if ($addService) {
- $this->serviceManager->setFactory('ZendTest\Mvc\TestAsset\PathController', function() {
+ $controllerLoader = $this->serviceManager->get('ControllerLoader');
+ $controllerLoader->setFactory('path', function() {
return new TestAsset\PathController;
});
}
@@ -252,7 +255,8 @@ public function setupActionController()
));
$router->addRoute('sample', $route);
- $this->serviceManager->setFactory('ZendTest\Mvc\Controller\TestAsset\SampleController', function() {
+ $controllerLoader = $this->serviceManager->get('ControllerLoader');
+ $controllerLoader->setFactory('sample', function() {
return new Controller\TestAsset\SampleController;
});
$this->application->bootstrap();
@@ -275,7 +279,8 @@ public function setupBadController($addService = true)
$router->addRoute('bad', $route);
if ($addService) {
- $this->serviceManager->setFactory('ZendTest\Mvc\Controller\TestAsset\BadController', function() {
+ $controllerLoader = $this->serviceManager->get('ControllerLoader');
+ $controllerLoader->setFactory('bad', function() {
return new Controller\TestAsset\BadController;
});
}
@@ -372,10 +377,9 @@ public function testExceptionsRaisedInDispatchableShouldRaiseDispatchErrorEvent(
*/
public function testInabilityToRetrieveControllerShouldTriggerDispatchError()
{
- $this->markTestIncomplete('Cannot determine how to get ControllerLoader and/or ServiceManager to raise expected exception');
- $this->serviceManager->get('ControllerLoader');
$this->setupBadController(false);
- $this->serviceManager->setInvokableClass('bad', 'DoesNotExist');
+ $controllerLoader = $this->serviceManager->get('ControllerLoader');
+ $controllerLoader->setInvokableClass('bad', 'DoesNotExist');
$response = $this->application->getResponse();
$events = $this->application->events();
$events->attach('dispatch.error', function ($e) use ($response) {
@@ -442,10 +446,9 @@ public function testRoutingFailureShouldTriggerDispatchError()
*/
public function testLocatorExceptionShouldTriggerDispatchError()
{
- $this->markTestIncomplete('Cannot determine how to force controller loader to fail loading the class');
- $this->serviceManager->get('ControllerLoader');
$this->setupPathController(false);
- $this->serviceManager->setInvokableClass('path', 'InvalidClassName');
+ $controllerLoader = $this->serviceManager->get('ControllerLoader');
+ $controllerLoader->setInvokableClass('path', 'InvalidClassName');
$response = new Response();
$this->application->events()->attach('dispatch.error', function($e) use ($response) {
return $response;

No commit comments for this range

Something went wrong with that request. Please try again.