Reputation: 435
I am using wamp 2.2 in win 7 and trying to install phpunit
1.I downoad phpunit-master.zip from https://github.com/sebastianbergmann/phpunit. 2. I unzip it. 3. I put it under D:\wamp\bin\php\php5.3.10, Then, I run below php script;
<?php
//testsuite.wordcount.php
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once "PHPUnit/Framework/TestSuite.php";
require_once "class.testwordcount.php";
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTestSuite("TestWordCount");
PHPUnit_TextUI_TestRunner::run($suite);
?>
The output is: *Warning: require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\oop\test.php on line 4*
It seems that I did not install phpunit correctly, so what may go wrong?
Upvotes: 0
Views: 434
Reputation: 8577
You can't just plop the files there and hope for it to work, you need to follow the installation instructions here: https://github.com/sebastianbergmann/phpunit#installation
For me, the easiest way I've found to install it is via Pear if you're happy to have it installed system wide, although this can get messy down the track with upgrades, different versions etc, or on a per project basis you can install via composer (which is my preference)
Upvotes: 0
Reputation: 1158
Run the following commands (they may take a while to update):
pear channel-update pear.php.net
pear upgrade-all
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels
To install PHPUnit, run
pear install --alldeps --force phpunit/PHPUnit
To test that PHPUnit was successfully installed, run
phpunit -v
Upvotes: 4