[英]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.