For a given project I have two php files to run php unittests, which are located in subdirectories.
The first file (AllTestSuite.php
) looks like this:
<?php
require_once dirname(__FILE__).'/unittest.inc.php';
class AllTestsSuite {
public static function suite(){
return new GlobTestsSuite(dirname(__FILE__), "/*/*Suite.php");
}
}
?>
and the second file (unittest.inc.php
) looks like this:
<?
class GlobTestsSuite extends PHPUnit_Framework_TestSuite {
public function __construct($sDirectory, $sExpression){
parent::__construct();
foreach (glob("$sDirectory/$sExpression") as $sTest){
require_once($sTest);
$this->addTestSuite(basename($sTest, ".php"));
}
}
}
?>
The tests itself are invoked (on Ubuntu, phpunit
Version 3.7.27) as follows:
phpunit AllTestsSuite ./AllTestsSuite.php
which gives the error message
PHP Fatal error: Class 'GlobTestsSuite' not found in /home/.../AllTestsSuite.php on line 6
I do not understand what is going here. The file AllTestsSuite.php
imports the other file in which the class GlobTestSuite
is defined. How to fix this problem?