Ubuntu 怎样安装phpunit
安装方法:
pear upgrade PEAR sudo pear channel-discover pear.phpunit.de
sudo pear install --alldeps phpunit/PHPUnitpear help pear install phpunit/PHPUnit_Selenium
pear list phpunit
测试程序
目标程序 :Demo.php <?php class Demo { public function sum($a,$b) { return $a+$b; } public function subtract($a,$b){ return $a-$b; } }
用例程序 : DemoTest.php <?php require ('./Demo.php'); class DemoTest extends PHPUnit_Framework_TestCase { public function testSum() { $demo = new Demo(); $this->assertEquals(4,$demo->sum(2,2)); $this->assertNotEquals(2,$demo->sum(3,1)); } }
现主要从事PHP、Uinx/Linux、C/C++等方面的项目开发。