繁体   English   中英

phing phpunit“已注册stackIndex为“ 1”的插件”错误

[英]Phing phpunit “plugin with stackIndex ”1“ already registered” error

对于我的Zend Framework(v1.12)项目部署,我使用Phing。 它部署前端和后端应用程序。 一切顺利,直到Phing开始phpunit测试:

<!-- Testing backend -->    
<target name="backend-test" description="Testing backend system"> 
    <phpunit codecoverage="false" haltonerror="true" haltonfailure="true" printsummary="true" bootstrap="${path.build}/${DSTAMP}${TSTAMP}/admin/tests/bootstrap.php">
        <batchtest>
            <fileset dir="${path.build}/${DSTAMP}${TSTAMP}/admin/tests">
                <include name="**/*Test.php" />
            </fileset>
        </batchtest>
       <formatter type="summary" usefile="false" />
    </phpunit>  
</target>

<!-- Testing frontend environment -->   
<target name="site-test" description="Testing frontend system"> 
    <phpunit codecoverage="false" haltonerror="true" haltonfailure="true" printsummary="true" bootstrap="${path.build}/${DSTAMP}${TSTAMP}/site/tests/bootstrap.php">
        <batchtest>
            <fileset dir="${path.build}/${DSTAMP}${TSTAMP}/site/tests">
                <include name="**/*Test.php" />
            </fileset>
        </batchtest>
       <formatter type="summary" usefile="false" />
    </phpunit>  
</target>

后端部分phpunit测试成功,但是当它开始测试前端时-失败,错误:

[phingcall]堆栈索引为“ 1”的插件已注册[phingcall]#0 /var/www/zend/Controller/Front.php(733):Zend_Controller_Plugin_Broker-> registerPlugin(Object(Application_Plugin_ACL),1)[phingcall]#1 / var / www / _qa / build / 201311181711 / admin / application / Bootstrap.php(199):Zend_Controller_Front-> registerPlugin(Object(Application_Plugin_ACL),1).......

有任何想法吗? 您的帮助将不胜感激。

您的引导程序被调用两次(或至少调用资源[ _init函数])。

之所以会出现此错误,是因为您无法为同一堆栈索引定义其他插件实例。

您应该尝试找到一种方法来模拟引导程序中加载的所有外围类,并分别测试每个类。

另一种方法是在phpUnit设置方法中引导您的应用程序,并确保它在拆卸中被销毁。 这将更加耗费资源,并且很可能会减慢测试速度,因为将针对每个测试用例实例化整个Zend堆栈,然后将其杀死,然后重新实例化。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM