ZF-8045: setUp() behaves differently in 1.9: can't resolve static helpers in setUp() method

Issue Type: Unit Tests: Problem Created: 2009-10-10T09:21:57.000+0000 Last Updated: 2012-11-20T20:53:37.000+0000 Status: Closed Fix version(s): Reporter: Constantin Ehrenstein (skiller) Assignee: None Tags: - Zend_Test_PHPUnit

Related issues: Attachments:


Problem Description:

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()


Posted by Rob Allen (rob) on 2012-11-20T20:53:37.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.