I have the following code:
<?php
class MyTest extends PHPUnit_Framework_TestCase
{
public function testCalculate()
{
$this->assertEquals(2, 1 + 1);
}
}
?>
When I open a PHP file in a browser, I get the following error:
Fatal error: class 'PHPUnit_Framework_TestCase' not found
However, if I use the command line, it works fine: phpunit [local_path_here] /testcase.php
Result:
.
Time: 0 seconds, Memory: 5.00Mb
OK (1 test, 1 assertion)
Why? How can I run it in a browser?
source
share