ข้ามไปที่เนื้อหาหลัก

บทความ

กำลังแสดงโพสต์ที่มีป้ายกำกับ phing

phpunit test installation

install pear first windows php5/go pear.bat install on local copy It will be installed on the php5 folder ubuntu linux $ apt-get install php-pear install phpunit วิธีลงทำ ตามนี้ pear channel-discover pear.phpunit.de pear install phpunit/PHPUnit ตัวอย่างโค้ด MyPhpClassTest.php Note : MyPhpClass.php คือ คลาสที่เราต้องการจะเทส <? require_once '../MyPhpClass.php'; require_once '/usr/share/php/PHPUnit/Framework/TestCase.php'; class MyPhpClassTest extends PHPUnit_Framework_TestCase{ private $myPhpClass = null; protected function setUp(){ $this->myPhpClass = new MyPhpClass(); } protected function tearDown(){ $this->myPhpClass = null; } public function testGetUserRank(){ $this->assertEquals(date('Y-m-d'), $this->myPhpClass->getDate()); } } ?> วิธีรันเทส $ phpunit MyPhpClassTest.php install phing ลง ตามนี้ $ pear channel-discover pear.phing.info $ pear install phing/phing สร้างไฟล์ build.xml เพื่อบอกว่าจะรัน unit test อะไร $ phing build.xml มั...