Zend_Tool CLI Issues, Fatal Errors
Before installing PHPUnit on my Ubuntu machine, I thought I had zf.sh set up correctly. I was able to create a new project without any problem. Now, starting with the PHPUnit installation, things are not working properly.
When I try to create a test project, I get this:
Fatal error: Cannot redeclare class PHPUnit_Framework_TestSuite_DataProvider in /usr/share/php/PHPUnit/Framework/TestSuite/DataProvider.php on line 64
Call Stack:
0.0011 110200 1. {main}() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:0
0.0011 110320 2. zf_main() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:23
0.0113 685448 3. zf_run() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:36
0.0113 685568 4. Zend_Tool_Framework_Client_Console::main() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:214
0.0114 686044 5. Zend_Tool_Framework_Client_Abstract->dispatch() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Console.php:96
0.0114 686164 6. Zend_Tool_Framework_Client_Abstract->initialize() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:209
0.0152 866128 7. Zend_Tool_Framework_Loader_Abstract->load() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:118
0.4374 2729116 8. include_once('/usr/share/php/PHPUnit/Framework/TestSuite/DataProvider.php') /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Loader/Abstract.php:90
What do I need to do to get it working again?
Update: I think I understand the reason why this is happening. PHPUnit 3.4.0 has a class with the same name as Zend Framework 1.9.3. This appears to be a known issue . But how can I get around this in order to use Zend_Tool again? Can I downgrade PHPUnit? Will this help solve the problem?
Update: This tutorial mentions something about installing a diff patch.
source to share
I found a temporary solution:
-
Edit PHPUnit / Framework.php, next to line 70:
require 'PHPUnit/Framework/TestSuite/DataProvider.php';
-
Change to:
require_once 'PHPUnit/Framework/TestSuite/DataProvider.php';
This is probably not a long-term fix, but it does address the immediate symptom.
Update 2009-11-20: I just saw a commit for the ZF 1.9 branch that claims to resolve this issue . Presumably, the fix will be in the next release (1.9.6) and subsequent minor releases (1.10.0 and later).
source to share
Another solution, which does not require changing any 3rd party code, copies the PHPUnit folder to a location outside include_path
and instead creates a symbolic link to the new location.
For more information on this issue see here: Zend_Tool does not work PHPUnit
source to share