Reputation: 461
I have install PHPUnit using pear but when I try to make a test I get the following error on including the phpunit framework.
this is the php test script
<?php
require_once ('PHPUnit/Framework');
class Mytest extends PHPUnit_Framework_TestCase
{
private $o;
protected function setUp()
{
$this->o=new Myclass();
}
public function testId()
{
$this->assertEquals(null,$this->o->getID());
}
}
class Myclass{
private $_id;
public function getID()
{
return $this->_id;
}
}
End the erro is code is:
require_once(C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework): failed to open stream: Permission denied
I tried a lot of things but couldn't get no result!!
Upvotes: 0
Views: 172
Reputation: 41934
The require
function in PHP includes files in the current file. This is different from the require
function that your properbly are used to use in Ruby, where it means 'load a library'.
But you can remove the complete require function from this case. If you test the complete test suite (with phpunit
) the PHPunit classes will automatically included, so you can use them directly.
Upvotes: 2
Reputation: 66188
require once expects a file. Most likely the change required is to replace:
require_once ('PHPUnit/Framework');
with:
require_once 'PHPUnit/Framework.php';
note that require_once is a statement, not a function - the parentheses serve no purpose.
Upvotes: 2