0
votes

I noticed on Can't get Zend Studio and PHPunit to work together that a comment says

If you want ZS to run the PHPunit bootstrap, you have to specifically select the file PHPunit.xml and tell it to run as PHPunit test. If you just select an individual test and run as PHPunit test, the bootstrap will not be run

That trick actually helped me to be able to run unit tests at all. However as my unit tests grow, it's becoming more and more painful to have to run the entire test suite when I just need to run my most recently written test.

So I need help adding the necessary code to the unit test (presumably in setUp) so that both the tests/bootstrap.php and the regular bootstrap for the whole application run. Hopefully this would let me do right click -> run as -> PHPUnit Test on an individual test file.

I'm new to Zend / Zend Studio so please keep answers on a basic level. The current setUp() function for one of my tests is the following, which I believe runs the whole app's boostrap:

public function setUp() {
    $this->bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
    parent::setUp();
}

How does this need to change to enable running just this test file in isolation? (which I think involves calling both the tests/bootstrap.php and the application bootstrap as above)

1

1 Answers

0
votes

You have to setup phpunit with zend studio / eclipse first, then you can run each unit test file individually in your IDE console.

Here's a tut that might help