PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Testing » PHPUnit2 » Bug #3402

Class 'PHPUnit2_Framework_TestCase' not found

Details

Submitted2005-02-08 12:20 UTC
Frommichael dot caplan at lechateau dot ca
Assignedsebastian
StatusClosed
PackagePHPUnit2
PHP Version5.0.3
OSRHE 3
Roadmaps(Not assigned)

Comments

[2005-02-08 12:20 UTC] michael dot caplan at lechateau dot ca

Description:
------------
When running from a web environment, I get the following critical error:

Fatal error: Class 'PHPUnit2_Framework_TestCase' not found in /home/michael/Documents/intranet_3/lib/PHPUnit2/Framework/Warning.php on line 26

The unit test run is a skeleton created by PHPUnit2 (see below). 'PHPUnit2_Framework_TestCase' is included, so I don't see what the problem is.

As an aside, is there a way to run PHPUnit2 from a web environment, or is commandline the only output supported to date?

Reproduce code:
---------------
<?php
if (!defined("PHPUnit2_MAIN_METHOD")) {
define("PHPUnit2_MAIN_METHOD", "ProfileTest::main");
}

require_once "PHPUnit2/Framework/IncompleteTestError.php";
require_once "PHPUnit2/Framework/TestCase.php";

/**
* Test class for Profile.
* Generated by PHPUnit2_Util_Skeleton on 2005-02-07 at 09:12:22.
*/
class ProfileTest extends PHPUnit2_Framework_TestCase {
public static function main() {
require_once "PHPUnit2/Framework/TestSuite.php";
require_once "PHPUnit2/TextUI/TestRunner.php";

$suite = new PHPUnit2_Framework_TestSuite("ProfileTest");
$result = PHPUnit2_TextUI_TestRunner::run($suite);
}

/**
* @todo Implement testGetInstance().
*/
public function testGetInstance() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testAdd().
*/
public function testAdd() {
$res = Tracking_Profile::add('test', 'test', 199834);
$this->assertSame('Tracking_Profile', $res, 'Expected Tracking_Profile object');
}

/**
* @todo Implement testDelete().
*/
public function testDelete() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testCountUserProfiles().
*/
public function testCountUserProfiles() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetLevel().
*/
public function testGetLevel() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetLevels().
*/
public function testGetLevels() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetNextLevel().
*/
public function testGetNextLevel() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetID().
*/
public function testGetID() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetModule().
*/
public function testGetModule() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetName().
*/
public function testGetName() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testGetOwnerID().
*/
public function testGetOwnerID() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testIsGlobal().

*/
public function testIsGlobal() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testIsDefault().
*/
public function testIsDefault() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testAddLevel().
*/
public function testAddLevel() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testDeleteLevel().
*/
public function testDeleteLevel() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testSetProperties().
*/
public function testSetProperties() {
throw new PHPUnit2_Framework_IncompleteTestError;
}

/**
* @todo Implement testIsProfileTracking().
*/
public function testIsProfileTracking() {
throw new PHPUnit2_Framework_IncompleteTestError;
}
}

if (PHPUnit2_MAIN_METHOD == "ProfileTest::main") {
ProfileTest::main();
}
?>

[2005-02-08 16:47 UTC] michael dot caplan at lechateau dot ca

Sebastian,

thanks for looking into the problem. FYI, I was able to reproduce it on two seperate boxes, both running PHP 5.03. To be sure PHPUnit2/Framework/TestCase.php for some strange reason was not included by the time PHPUnit2/Framework/Warning.php was called, I did a require_once directly in the file. Same problem.

Really strange....

[2005-10-19 20:06 UTC] jonah dot gabriel at gmail dot com

I am running the lastest version 2.3.0 of PHPUnit2 and am still having this problem, so apparently it has not been fixed in the latest released version.

[2005-10-20 05:00 UTC] sebastian at php dot net

Once again I added a workaround for this. This issue will be properly fixed in PHPUnit 2.4, which will use the SPL Autoloader of PHP 5.1.0 to resolve the circular dependencies.