Hi ,
I installed PHPUnit successfully but fails to run the test example.
<?php
require_once 'PHPUnit2/Framework/TestCase.php';
class ArrayTest extends PHPUnit2_Framework_TestCase {
public function testNewArrayIsEmpty() {
// Create the Array fixture.
$fixture = Array();
// Assert that the size of the Array fixture is 0.
$this->assertEquals(0, sizeof($fixture));
}
public function testArrayContainsAnElement() {
// Create the Array fixture.
$fixture = Array();
// Add an element to the Array fixture.
$fixture[] = 'Element';
// Assert that the size of the Array fixture is 1.
$this->assertEquals(1, sizeof($fixture));
}
}
Error received:
Warning: require_once(PHPUnit2/Framework/TestCase.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\priti\ est.php on line 2
Fatal error: require_once() [function.require]: Failed opening required ‘PHPUnit2/Framework/TestCase.php’ (include_path=‘.;C:\xampp\php\PEAR’) in C:\xampp\htdocs\priti\ est.php on line 2
then I saw in pear directory the PHPUnit is installed in PHPUnit dir nto PHPUnit2 Hence I modify the following lines
equire_once ‘PHPUnit/Framework/TestCase.php’;
class ArrayTest extends PHPUnit_Framework_TestCase {
Which throw following error
Fatal error: Cannot redeclare class PHPUnit_Framework_TestCase in C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php on line 116
I am not able to find proper solution on this. I am trying this on XAMPP on window /localhost.
I tried googling it but as said no luck solving this issue.
Please help.