I am not certain what your error is, but I can tell you, somewhere your code is 
throwing an exception. It could be a session error, since you are using 
Zend_Auth.

I got this error , while running tests, for about a week before I noticed my 
database was not being loaded and was throwing an exception. I use MAMP, but 
cannot get PHPUnit to work with it, so I installed PHPUnit on with OSX's PHP 
install and got that to work, only it was not loading the MAMP MySQL socket, I 
added the socket to the php.ini and it worked.

This exception somehow resets your front controller object. I never found out 
why it does this, but I looked at my error_log and saw the exception.

If your code runs fine and then when you test it you get this error, you have 
an exception during bootstrap and the only way to find that exception, at least 
for me, was the error_log.

Hope this puts you on the right path.

On Dec 22, 2010, at 7:02 PM, jiewmeng wrote:

> 
> I have a unit test like 
> 
> 
> class Application_Controller_Plugin_AclTest extends
> Zend_Test_PHPUnit_ControllerTestCase {
> 
>  public function setUp() {
>    $this->getFrontController()->setDefaultModule('default');
>  }
> 
>    public function testAccessToUnauthorizedPageRedirectsToLogin() {
>      $this->dispatch('/projects');
>      $this->assertController('auth');
>      $this->assertAction('login');
>    }
> 
>    public function testAccessToAllowedPageWorks() {
>      $auth = Zend_Auth::getInstance();
>      $authAdapter = new Application_Auth_Adapter('jiewmeng', 'password');
>      $auth->authenticate($authAdapter);
> 
>      $this->dispatch('/projects');
>      $this->assertController('projects');
>      $this->assertAction('index');
>    }
> 
> }
> 
> 
> I am getting the error
> 
> 
> 1)
> Application_Controller_Plugin_AclTest::testAccessToUnauthorizedPageRedirectsToLogin
> Zend_Controller_Exception: No default module defined for this application
> 
> D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:391
> D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:204
> D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Dispatcher\Standard.php:244
> D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Controller\Front.php:954
> D:\ResourceLibrary\Frameworks\PHPFrameworks\Zend\Test\PHPUnit\ControllerTestCase.php:205
> D:\Projects\Tickle\tests\application\controllers\plugins\aclTest.php:10
> 
> 
> for the 1st test, but not the 2nd why is that? 
> 
> 
> I noticed that I cannot put something like ...
> 
> 
> $front = Zend_Controller_Front::getInstance();
> $front->setDefaultModule('default');
> 
> 
> into the bootstrap.php of my unit tests, I does not seem to do anything, I
> still get No default module defined, if I put it in setup(), I will get the
> above where the 1st test fails but the 2nd passes
> 
> -- 
> View this message in context: 
> http://zend-framework-community.634137.n4.nabble.com/No-default-module-defined-for-application-Zend-Test-tp3161541p3161541.html
> Sent from the Zend Framework mailing list archive at Nabble.com.

Shawn Ostler
InclusiveDv
[email protected]
801-688-6946


Reply via email to