Reputation: 3
I'm just doing some sample with Zend Framework. I created an Album module as the official tutorial said. It works well. Now I wanted to add Unti testing to this module. I'm using this guide: http://framework.zend.com/manual/2.1/en/tutorials/unittesting.html But at the "A failing test case" chapter I got a different error.
C:\wamp\www\zf2-tutorial\module\Album\test>phpunit PHPUnit 3.7.19 by Sebastian Bergmann.
Configuration read from C:\wamp\www\zf2-tutorial\module\Album\test\phpunit.xml
←[31;1mE←[0m
Time: 0 seconds, Memory: 8.75Mb
There was 1 error:
1) AlbumTest\Controller\AlbumControllerTest::testIndexActionCanBeAccessed include(/var/www/zf2-tutorial/config/application.config.php): failed to open str eam: No such file or directory
C:\wamp\www\zf2-tutorial\module\Album\test\AlbumTest\Controller\IndexControllerT est.php:14 C:\wamp\www\zf2-tutorial\module\Album\test\AlbumTest\Controller\IndexControllerT est.php:14
←[37;41m←[2KFAILURES! ←[0m←[37;41m←[2KTests: 1, Assertions: 0, Errors: 1. ←[0m←[2K
What can be the problem here? I'm searching for a solution, but can find any for this problem yet.
(Sorry for my english)
Upvotes: 0
Views: 654
Reputation: 2730
Obviously the paths are wrong.
The output says "Configuration read from C:\wamp\www\zf2-tutorial\module\Album\test\phpunit.xml", but the error message complains about "/var/www/zf2-tutorial/config/application.config.php" not being found.
So the solution would be to change in AlbumControllerTest
$this->setApplicationConfig(
include '/var/www/zf2-tutorial/config/application.config.php'
);
to
$this->setApplicationConfig(
include 'C:/wamp/www/zf2-tutorial/config/application.config.php'
);
or even better (untested):
$this->setApplicationConfig(
include APPLICATION_PATH . '/../config/application.config.php'
);
Upvotes: 0