จากบทความ
วิธีติดตั้ง phpunit
วันนี้เจอปัญหา อยู่ๆ phpunit หรือเจ้า unit test ทำงานไม่ได้
เพราะ เปลี่ยน เวอร์ชั่นของ xampp
พอจะใช้ unit test เช็ค functional test เจอปัญหาตามนี้
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No su
ch file or directory in D:\xampp\php\phpunit on line 38
Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.ph
p' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\php\phpunit on line 38
ทางแก้คือ ให้ทำการอัพเดด Pear ใหม่
แต่เมืออัพแดด pear แล้วยังเจอปัญหา
phpunit Fatal error: Call to undefined method PHP_CodeCoverage_Filter::getInstance() in
ให้แก้ โดย force install ใหม่ ด้วย packet ใหม่เลย
โค้ด: เลือกทั้งหมด
#pear channel-discover pear.phpunit.de
#pear channel-discover pear.symfony-project.com
#pear channel-discover components.ez.no
#pear update-channels
#pear upgrade-all
#pear install --alldeps phpunit/PHPUnit
#pear install --force --alldeps phpunit/PHPUnit
รอซักพัก phpunit เราก็จะกลับมาใช้งานได้เหมือนเดิม