I've been struggling with my configuration for 2 days now.
When I launch phpunit from my bash emulator (working under windows 7)
bin/phpunit -c app
I got the following error:
Configuration read from C:\wamp\www\myproject\app\phpunit.xml.dist
..PHP Fatal error: Class 'myproject\Business\Tests\Entity\PHPUnit_Extensions_Databas e_DataSet_YamlDataSet' not found in C:\wamp\www\myproject\src\myproject\Business\Tests\eUserManagerTest.php on line 39
My environment is trying to suffix the path of PHPUnit_Extensions_Database_DataSet_YamlDataSet with
myproject\Business\Tests\Entity whereas the require_once statement specifies this is defined in PHPUnit/Extensions/Database/DataSet/YamlDataSet.php.
The "new" statement below leads to this bad completion tentative:
namespace myproject\Business\Tests\Entity;
require_once "PHPUnit/Autoload.php";
require_once "PHPUnit/Extensions/Database/Autoload.php";
require_once "PHPUnit/Extensions/Database/DataSet/YamlDataSet.php';
use \PDO;
use myproject\Business\Entity\eUserManager;
class eUserManagerTest extends \PHPUnit_Extensions_Database_TestCase
{
...
/**
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
*/
protected function getDataSet()
{
return new PHPUnit_Extensions_Database_DataSet_YamlDataSet(
dirname(__FILE__)."/eusertable.yml"
);
}
My question is to figure out why the *!ù% it is not looking in the proper path (as defined in the require_once).
Maybe a lead: I found out two different phpunit exe files in my file tree:
/c/wamp/www/myproject/bin/phpunit
and
/c/wamp/bin/php/php5.4.3/phpunit
I think the first one has been created when I installed phpunit by declaring it in the composer.json file + launching :
composer update
This is working for unit tests not involving databases by launching:
bin/phpunit -c app
The second one has been installed through pear as explained on the phpunit documentation: http://phpunit.de/manual/3.8/en/database.html
Class definitions for database handling are at this second location:
/c/wamp/bin/php/php5.4.3/phpunit/pear/PHPUnit/Extensions/Database
And this is where I would expect php to look into for instantiating my class.
So my hint is the issue may be linked to this double phpunit installation (the one in symfony itself and the other one in the php5.4.3 directory).
Am I doing well?
Is there a mistake in my installation procedure?
How is Symfony aware of this database extension installation through pear?
Note: Launching:
/c/wamp/bin/php/php5.4.3/phpunit -c app
from /c/wamp/www/myproject is giving this error: sh.exe": /c/wamp/bin/php/php5.4.3/phpunit: .\php.exe: bad interpreter: No such file or directory
Thanks for your help