Zend Application not fully bootstraped when testing with PHPUnit
Zend Framework 1.11.2
PHPUnit 3.5.10 PHP 5.3.1 NetBeans 6.9.1- http://pastebin.com/L5bi9AgY
- I followed Lebensold's tutorial.
Testing works, even with things like
$this->dispatch('/');
$this->assertResponseCode(200);
, but as soon as I require a controller class (pastebin, #33) to instantiate it in the setUp() method, I get an error saying that PHPUnit didn't find the parent class (Zend_Controller_Action). So my guess is that I've somehow missed something in bootstrap, because I don't get all the classes loaded (?).
Also, when using the "@covers Class::method" annotation, I get the same type of error.
开发者_JAVA百科Any suggestions are welcomed. Thanks.
Try requiring the controller class from within your setup, e.g.
class SearchControllerTest extends ControllerTestCase {
public function setUp() {
parent::setUp();
require_once(APPLICATION_PATH . '/controllers/SearchController.php');
}
}
I remember having similar problem and it worked this way.
精彩评论