views:

23

answers:

1

I am new to testing and trying to set it up in a Zend Framework application. The app is only available to logged in users. The login page uses a different layout than the rest of the app

LoginController.php contains:

public function init()
{
    $this->_helper->layout()->setLayout('loginlayout');
    parent::init();
}

However, setting up a test to test the LoginController, gives an exception which refers to our main layout. So it seems this init() code is being ignored by the test and the proper layout is not being set.

Here is the test code I am using:

class LoginControllerTest extends ControllerTestCase
{
    public function testCanDoUnitTest()
    {
        $this->dispatch('/login');
        $this->assertController('login');
        $this->assertAction('index');
        $this->assertResponseCode(200);
    }
}

Any help would be appreciated.

A: 

It seemed to be a problem with including E_STRICT in the error_reporting. When I removed that, it functions correctly.

Matt McCormick