0
votes

I'm wandering a jungle of "php oil test" command for few days.

I installed phpunit via pear in windows7. After the installation, When I execute "php oil test" command, following error occurs.

> php oil test

Uncaught exception Oil\Exception: PHPUnit does not appear to be installed.

However, it looks phpunit is installed correctly because "phpunit --version" command works fine(refer following).

>phpunit --version

PHPUnit 4.0.14 by Sebastian Bergmann.

Of course, "pear list" command shows PHPUnit package.

>pear list

INSTALLED PACKAGES, CHANNEL PEAR.PHPUNIT.DE:

PACKAGE VERSION STATE File_Iterator 1.2.3 stable

PHPUnit 4.0.14 stable

PHPUnit_SkeletonGenerator 1.2.1 stable

PHP_CodeCoverage 1.0.2 stable

PHP_Timer 1.0.0 stable

PHP_TokenStream 1.2.2 stable

Text_Template 1.2.0 stable

I tried some way listed following page, but cannot still resolve.

Installing PHPUnit via PEAR

Could anyone pl give some advice to run "php oil test" command w/o error?

Any advice is welcomed!!


add my code.

  • /fuel/core/classes/testcase.php

namespace Fuel\Core;

class TestCase extends \PHPUnit_Framework_TestCase { }

  • /fuel/app/tests/controller_testcase.php

use Fuel\Core\Log;

use Fuel\Core\DBUtil;

use Fuel\Core\DB;

use Fuel\Core\TestCase;

use Fuel\Core\Config;

use Fuel\Core\Request;

class ControllerTestCase extends TestCase {

public function setUp() {

..

php is installed C:\php and pear.bat & phpunit.bat are also there. PHPUnit folder does not exist in C:\php\pear folder.

1
are you sure it is included in your path?mamdouh alramadan
Thanks for the info. But phpunit has been included in my system 'path' env:-( Do y have any other idea?user2512088
Sorry for the confusion, I meant is it included in you code, do you have phpunit_framework_testcase included in your code?mamdouh alramadan
well.. I'm still in jungle. It looks ./fule/core/TestCase class extends PHPUnit_Framework_TestCase class. And my code extends the TestCase class. So I think there is no problem at this point. However PHPUnit_Framework_TestCase class does not exist in my pc anywhere. And PHPUnit/Autoload.php does not exist either. So I tried to reinstall phpunit via pear again, but "php oil test" command still does not work:-< What do you think what is wrong?user2512088
Please update your question with your codemamdouh alramadan

1 Answers

0
votes

Oil uses the configuration key "oil.phpunit.autoload_path" to find the location of PHPUnit autoloader, and if not defined, it uses "PHPUnit/Autoload.php", in combination with the defined PHP include paths.

It then attempts to include this file, and checks if the class "PHPUnit_Framework_TestCase" is available. If not, it bails out with the error message you see.

It has nothing to do with the PHPUnit binary, which is located using the defined path.

This simply means the location where PHPunit is installed is not in PHP's search paths, and no custom path is configured.