PHPUnit2
Posted:
06. October 2006 16:42
by youngfowl
Does anyone know how to use the PHPUnit2 for Unit Testing in XAMPP? Maybe the development team here can help. I would also like to help out with the documentation for using PHPUnit2 under XAMPP as a way of saying than you and helping others out.
Rgds,
Glenn Agilan Elangow
Like in the manual
Posted:
06. October 2006 17:36
by kmilo
As say in
http://www.phpunit.de/pocket_guide/3.0/ ... ation.html :
cd xampp\php
pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit
now add xampp\php to your PATH (Control Panel -> System -> Advanced Options -> Enviroment Vars -> PATH)
Read
http://www.onlamp.com/pub/a/php/2005/12/08/phpunit.html (is the more recent docs I know)
And susbcribe to the mail list:
http://www.phpunit.de/wiki/MailinglistsAndIrc
PHPUnit2 : Fatal Error
Posted:
06. October 2006 21:28
by youngfowl
Hey Kmilo,
Thanks for your speedy reply. Followed your steps..this is the error message I got....
Fatal error: Class 'PEAR_Config' not found in C:\Program Files\xampp\php\pear\PHPUnit2\Runner\StandardTestSuiteLoader.php on line 80
Posted:
06. October 2006 22:46
by kmilo
When you got that error?
PDT:
I use XAMP not XAMP Lite
When Running phpUnit ArrayTest
Posted:
06. October 2006 22:54
by youngfowl
1) I created a Test File called ArrayTest (not ArrayTest.php)
- Code: Select all
<?php
require_once 'PHPUnit2/Framework/TestCase.php';
class ArrayTest extends PHPUnit2_Framework_TestCase {
public function testNewArrayIsEmpty() {
// Create the Array fixture.
$fixture = Array();
// Assert that the size of the Array fixture is 0.
$this->assertEquals(0, sizeof($fixture));
}
public function testArrayContainsAnElement() {
// Create the Array fixture.
$fixture = Array();
// Add an element to the Array fixture.
$fixture[] = 'Element';
// Assert that the size of the Array fixture is 1.
$this->assertEquals(1, sizeof($fixture));
}
}
?>
From the Command Prompt
- Code: Select all
c:\Program Files\xampp\php\phpUnit ArrayTest
Thanks for the help man !!!