zeroByte
(Dispyfree)
October 12, 2012, 11:17am
1
Hi,
I simply copied a project from location A to location B. All of a sudden, phpunit won’t run anything anymore - the paths in the configuration files are relative, so there shouldn’t be any hassle.
$ phpunit unit
PHP Warning: include(unit.php): failed to open stream: No such file or directory in /var/www/libs/yii-git/framework/YiiBase.php on line 421
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:130
PHP 4. PHPUnit_Util_Skeleton_Test->__construct() /usr/share/php/PHPUnit/TextUI/Command.php:157
PHP 5. class_exists() /usr/share/php/PHPUnit/Util/Skeleton/Test.php:76
PHP 6. YiiBase::autoload() /var/www/libs/yii-git/framework/YiiBase.php:0
PHP Warning: include(): Failed opening ‘unit.php’ for inclusion (include_path=’.:/usr/share/php:/var/www/libs/yii/framework/’) in /var/www/libs/yii-git/framework/YiiBase.php on line 421
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:130
PHP 4. PHPUnit_Util_Skeleton_Test->__construct() /usr/share/php/PHPUnit/TextUI/Command.php:157
PHP 5. class_exists() /usr/share/php/PHPUnit/Util/Skeleton/Test.php:76
PHP 6. YiiBase::autoload() /var/www/libs/yii-git/framework/YiiBase.php:0
PHP Fatal error: Uncaught exception ‘PHPUnit_Framework_Exception’ with message ‘Neither “unit.php” nor “unit.php” could be opened.’ in /usr/share/php/PHPUnit/Util/Skeleton/Test.php:100
Stack trace:
#0 /usr/share/php/PHPUnit/TextUI/Command.php(157): PHPUnit_Util_Skeleton_Test->__construct(‘unit’, ‘’)
#1 /usr/share/php/PHPUnit/TextUI/Command.php(130): PHPUnit_TextUI_Command->run(Array, true)
#2 /usr/bin/phpunit(46): PHPUnit_TextUI_Command::main()
#3 {main}
thrown in /usr/share/php/PHPUnit/Util/Skeleton/Test.php on line 100
(unit, in this case, is a direct subdirectory of tests).
He won’t open files also if:
a) I pass himthe unit test file directly
I pass him the absolute path to the unit test file
phpunit.xml:
<phpunit bootstrap="bootstrap.php"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<selenium>
<!-- <browser name="Firefox" browser="*firefox" /> -->
</selenium>
</phpunit>
WebTestCase:
<?php
/**
*/
define(‘TEST_BASE_URL’,‘http://localhost/projects/imagedose/index-test.php/ ’);
/**
The base class for functional test cases.
In this class, we set the base URL for the test application.
We also provide some common methods to be used by concrete test classes.
*/
class WebTestCase extends CWebTestCase
{
/**
* Sets up before each test method runs.
* This mainly sets the base URL for the test application.
*/
protected function setUp()
{
parent::setUp();
$this->setBrowserUrl(TEST_BASE_URL);
$this->setBrowser('*firefox');
}
}
basePath in the test.php config:
dirname(__FILE__) . DIRECTORY_SEPARATOR . '..'
Permissions are set accordingly - the user is me, the group is www-data (for cron).
I’m grateful for every idea.
Regards,
zeroByte
(Dispyfree)
October 12, 2012, 3:44pm
2
Got it.
PHPUnit doesn’t tell you that it couldn’t find any tests matching its file pattern, instead it will tell you that it couldn’t load directory X as a file which you have never requested. Weird algorithm.
Regards,