Hi,
I'm just starting to use PHPUnit test and Zend_Test.
I've managed to get both running with my application but I'm facing a strange problem. The dispatching does not seem to be able to dispatch my requests to any other controller except IndexController and ErrorController.
I'll try to explain as clearly as possible as my application setup is rather convoluted.
I'm using a modular approach to developing my application. This is done with the following line in /application/bootstrap.php:
$frontController->addModuleDirectory(APPLICATION_PATH . '/modules');
Right now, there are no additional modules yet, only the default.
In my test, I created a MainControllerTest.php in /tests/
Aside from the normal setUp() and tearDown() methods, I have just one testRedirectionToDashboard() method in this class. This method is defined like this:
public function testRedirectionToDashboard()
{
$this->dispatch('/');
$this->assertController('index');
}
The above runs fine. Even if I change
$this->dispatch('/')
to
$this->dispatch('/index/look');
it works fine.
The problem occurs when I change the location to any controller other than index. So
$this->dispatch('/dashboard');
$this->assertController('dashboard');
will fail.
I have no idea why this is the case and I've tried everything I can think of. I guess it probably is something fundamental that has to do with the front controller but I'm new to PHPUnit and Zend_Test, and can't figure this out by myself.
Any help is appreciated. Thanks.
I've deliberately kept this message small for easier reading. If more information is needed, I can place it in follow-up posts. Thanks.
2008年12月30日星期二
订阅:
博文评论 (Atom)
没有评论:
发表评论