在Magento中查找PHPUnit测试的确切config.xml位置
我目前正试图让PHPUnit与Magento合作。在网上的一些地方,人们推荐EcomDev的扩展,所以我尝试了一下 我构建了一个示例设置,如中所述,我刚刚替换了EcomDev_示例。。。用Test\u JustTest\u 但是,它不能正常工作,我想我把数据放错了config.xml。目前,我已经在/app/code/local/Test/JustTest/etc/config.xml和扩展的config.xml中写下了模块名,以尝试不同的方法。嗯,我可以运行PHPUnit,但它总是告诉我没有测试可以运行在Magento中查找PHPUnit测试的确切config.xml位置,phpunit,magento-1.7,Phpunit,Magento 1.7,我目前正试图让PHPUnit与Magento合作。在网上的一些地方,人们推荐EcomDev的扩展,所以我尝试了一下 我构建了一个示例设置,如中所述,我刚刚替换了EcomDev_示例。。。用Test\u JustTest\u 但是,它不能正常工作,我想我把数据放错了config.xml。目前,我已经在/app/code/local/Test/JustTest/etc/config.xml和扩展的config.xml中写下了模块名,以尝试不同的方法。嗯,我可以运行PHPUnit,但它总是告诉我没有测
我花了很多时间在谷歌上,没有找到一个更详细的例子我遇到了同样的问题,但现在我找到了它的工作。 我创建了app/code/local/Namespace/Module/etc/config.xml,其中包括:
<?xml version="1.0"?>
<config>
<phpunit>
<suite>
<modules>
<Namespace_Module/>
</modules>
</suite>
</phpunit>
<modules>
<namespace_module>
<version>0.1</version>
</namespace_module>
</modules>
<global>
<models>
<eav>
<rewrite>
<entity_increment_numeric>Namespace_Module_Model_Entity_Increment_Numeric</entity_increment_numeric>
</rewrite>
</eav>
</models>
</global>
</config>
0.1
名称空间\模块\模型\实体\增量\数值
事实上,这些模块的名称并不是Namespace_Module,我只是替换它来向您展示。它是一个覆盖magento的数值模型的模块,但它没有太大的区别
确保我的测试正在进行中
app/code/local/Namespace/Module/Test/Model/Entity/Increment/Numeric.php
看起来:
<?php
class Namespace_Module_Test_Model_Entity_Increment_Numeric extends EcomDev_PHPUnit_Test_Case
{
/**
* Test Next Id Never Returns zero
*
* @test
*/
public function testGetNextIdNeverReturnsZero(){
$this->assertTrue(true);
}
}
谢谢您的回复!已经有一段时间了,问题不再是最新的,但你的答案听起来不错,所以我接受了。再次感谢!当我再次面对这样的事情时,我会记住这一点