Fatal error: Class 'PHPUnit_Framework_TestCase' not found

pear, php, phpunit

Solution

Are you trying to run the test in a web browser? This confused me for a while. PHPUnit tests are written to be run on the command line.

Problem

I am using XAMPP 1.8.1, Windows 7 64 bit, Netbeans IDE 7.4 I have installed PHPUnit. When I run a code, I am getting the below error. Fatal error: Class 'PHPUnit_Framework_TestCase' not found in D:\xampp\htdocs\PHPUnit\index.php on line 6 The Code is: ``` <?php class StackTest extends PHPUnit_Framework_TestCase { public function testPushAndpop() { $stack = array(); $this->assertEquals(0, count($stack)); array_push($stack, 'foo'); $this->assertEquals('foo', $stack[count($stack) - 1]); $this->assertEquals(1, count($stack)); $this->assertEquals('foo', array_pop($stack)); $this->assertEquals(0, count($stack)); } } ?> ``` I have added D:\xampp\php in environment variable PATH Anyone suggest me how to solve this problem? Thanks in advance.

Original source