ZF-8045: setUp() behaves differently in 1.9: can't resolve static helpers in setUp() method
I have several tests set up for my application.
In one test class, I am testing a helper class named Library which gets called via Zend_Controller_Action_HelperBroker::getStaticHelper('library').
With 1.8, I could assign the helper to a protected variable withing the setUp() method and use it in my test methods.
With 1.9.3, trying to do the same yields the following error:
Zend_Controller_Action_Exception: Action Helper by name Library not found
/Applications/ZendFramework-1.9/library/Zend/Controller/Action/HelperBroker.php:369 /Applications/ZendFramework-1.9/library/Zend/Controller/Action/HelperBroker.php:155 /Users/skiller/Projekte/skiller/tests/application/helpers/LibraryTest.php:10
If I refrain from setting up the helper in the setUp() method and call getStaticHelper() from the test method itself, the Library class can be resolved and the test runs normally.
This defies the purpose of the setUp() method, doesn't it?
Steps to reproduce: - define a helper path in the bootstrap file of your application - call Zend_Controller_Action_HelperBroker::getStaticHelper('helperName') from the setUp() method of an instance of a Zend_Test_PHPUnit_ControllerTestCase subclass
Actual result: Zend_Controller_Action_Exception: Action Helper by name Library not found
Expected result: I should be able to set up the helper class in the setUp() method just like it used to be with 1.8.
Workarounds: call getStaticHelper() from the test method instead of from setUp()