I am having a hard time trying making PHPUnit work. My Directory is for php is C:/wamp/bin/php/php5.4.3 Now, I read PHPUnit does not work without PEAR, so I got the go-pear.phar file and placed it in C:/wamp/bin/php/php5.4.3/PEAR/ ran the go-pear.phar file and installed in on the system. third, I installed PHPUnit using Git Bash and put it in C:/wamp/www/local/unit-testing/ (Not sure if the directories are correct)
Now, I created a simple UserTest file
<?php require_once "phpunit/PHPUnit/Autoload.php"; require_once "User.php"; class UserTest extends PHPUnit_Framework_TestCase { protected $user; // test the talk method protected function setUp() { $this->user = new User(); $this->user->setName("Tom"); } protected function tearDown() { unset($this->user); } public function testTalk() { $expected = "Hello world!"; $actual = $this->user->talk(); $this->assertEquals($expected, $actual); } } And tried to require this file and run it from the command line in Windows. But, due to lack of instructions on where this files should exactly be, I can't seem to run it.
As of now the problem is command line does not recognize the PEAR command. Even though, I had run PEAR_ENV.reg file to add PATH variables to the file.
secondly, I am not sure where exactly PEAR & PHPUnit should be installed in my current structure. I keep all my php pages/project in C:/wamp/www/local/<-- I need to test files in this directory.