【发布时间】:2013-07-26 06:21:01
【问题描述】:
我正在尝试使用 EcomDev_PHPUnit 包在 Magento 上进行单元测试,但在配置它时遇到了一些问题。我已经在这里发布了对我有用的问题和解决方案 -
MAGENTO.stackexchange.com-Pointers to write unit test cases using EcomDev_PHPUnit
现在,我有一个非常笼统的问题,
class Webservice_Clientservice_Test_Model_ClientserviceimplTest extends EcomDev_PHPUnit_Test_Case{
public function testBasicFunctionality(){
try{
//Mage::log("testBasicFunctinality");
$this->assertSame(true,false);
}catch(Exception $e){
Mage::logException($e);
}
}
}
当我使用
运行这个测试时phpunit --group Webservice_Clientservice
我得到以下信息,
phpunit --group Webservice_Clientservice
PHPUnit 3.7.22 by Sebastian Bergmann.
Configuration read from /mnt/www/dev.magento.com/phpunit.xml.dist
..
Time: 3 seconds, Memory: 22.25Mb
OK (2 tests, 2 assertions)
我原以为断言会失败,而测试用例最终会失败……它怎么会通过?确实有问题... True 不能等于 false :( 而且,测试用例也运行了两次?我不知道为什么....
【问题讨论】:
-
您找到解决方案了吗?
-
@group注释在哪里?
标签: php magento phpunit assert assertions