Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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'
);
share|improve this answer
    
Wow... thats pretty awkward, becouse I had this idea few hours ago, but somehow didn't try it... Btw thx for the answer! –  Adam Apr 26 '13 at 11:03
    
you're welcome. btw: if the answer did solve your problem, I would appreciate it if you marked it as "accepted answer" :) –  moeso Apr 26 '13 at 11:05
    
Be sure to make his last solution work. Your C:\ path will fail if you deploy to a linux server –  STLMikey Oct 3 '13 at 21:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.