cmiddlebrook Posted June 29, 2009 Share Posted June 29, 2009 Hi there, I have a simple Zend Framework application and I am experimenting with unit testing before I develop too much code. I am using Zend_Test and the tests run ok but the assertions fail on the simplest of tests. Here is an example of what I am doing: class AccountControllerTests extends Zend_Test_PHPUnit_ControllerTestCase { public $bootstrap = 'c:\xampp\htdocs\code\ima-live\tests\TestBootstrap.php'; public function testErrorController() { $this->dispatch('poo'); $this->assertController('error'); $this->assertAction('error'); } public function testDefaultAction() { $this->dispatch('/index'); $this->assertController('index'); } The test for the error controller passes but the test for the default action fails. If I assert the last Controller to be 'error' that works so I'm assuming that Zend is throwing some kind of exception causing the error controller to be invoked. The site itself works fine both locally (using Xampp) and on a live server that I have - it's just in this test environment that its failing. I'm not really sure where to go from here. Firstly I don't know why the tests are failing but I also don't know how to get more information. Is there any way to output debugging information from the tests or write to a log file etc. Any way to extract information about the error that's being reported? Any advice greatly appreciated, Caroline Quote Link to comment https://forums.phpfreaks.com/topic/164074-unit-testing-zend-controllers-errors/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.