title: zend framework phpunit proper way to bootstrap
body: <p>I am calling         </p>
  
  <pre><code>$this-&gt;application-&gt;bootstrap()-&gt;run(); 
  </code></pre>
  
  <p>from inside my test setup function, and there is no output.  Are you supposed to call <code>run()</code> in the test environment? </p>
  
  <p>My tests worked, but the front controller plugins never executed (which is necessary for my application).  Putting <code>-&gt;run()</code> executes the plugins, but the phpunit just stops and has no output.</p>
  
  <p>I have working tests, but I need front controller plugins to execute in test environment.  Bootstrap executes, but plugins do not.  When they do via <code>-&gt;run()</code>, no output comes</p>
  
  <p>Any suggestions?</p>
  
  <p>EDIT: added <code>setup()</code> example</p>
  
  <pre><code>require_once realpath(__DIR__.'/../../').'/TestBackendConfiguration.php';
  
  abstract class Controllers_Backend_BaseControllerTest extends Zend_Test_PHPUnit_ControllerTestCase {
  
      protected $config;
      protected $application;
      protected $users;
      protected static $iterations = 0;
  
      public function setUp() {
          $this-&gt;bootstrap = array($this, 'appBootstrap');
          parent::setUp();
          $this-&gt;configureUsers();
          $this-&gt;configureACL($this-&gt;users);
      }
  
      public function appBootstrap() {
          $this-&gt;config = new Zend_Config_Ini(CORE_PATH . '/configs/common.ini', APPLICATION_ENV, true);
          $this-&gt;config-&gt;merge(new Zend_Config_Ini(CORE_PATH . '/configs/backend.ini', APPLICATION_ENV));
          $this-&gt;config-&gt;merge(new Zend_Config_Ini(CORE_PATH . '/configs/application.ini', APPLICATION_ENV));
  
          // Reset bootstraps
          $this-&gt;config-&gt;bootstrap-&gt;path = CORE_PATH . '/backend/Bootstrap.php';
          $this-&gt;config-&gt;resources-&gt;frontController-&gt;controllerDirectory = CORE_PATH . '/backend/controllers';
          $this-&gt;config-&gt;resources-&gt;frontController-&gt;actionHelperPaths-&gt;Frontend_Controller_Action_Helper = CORE_PATH . '/backend/controllers/Action/Helper';
          $this-&gt;config-&gt;resources-&gt;frontController-&gt;baseUrl = "/admin";
          $this-&gt;config-&gt;resources-&gt;layout-&gt;layoutPath = CORE_PATH . '/backend/layouts/scripts';
  
  
          $this-&gt;application = new Zend_Application( APPLICATION_ENV, $this-&gt;config );
  
          $this-&gt;application-&gt;bootstrap()-&gt;run(); 
       }
  }
  </code></pre>
  
  <p>The reason for the tweaks to <code>$this-&gt;config</code> is because I have frontend and backend related tests, and they require different configs.  They have their own <code>Configuration.php</code> scripts which both declare <code>APPLICATION_PATH</code>, and thus which ever test runs 2nd can't redefine this const and the application doesn't bootstrap properly.  </p>
  
  <p>Right now, my main concern is that my plugins aren't dispatched in the test environment, and this breaks my application a bit because I have data added to the registry which I need access to and it's obviously not there.  Ideas? </p>
  
  <p>Adding the <code>-&gt;run()</code> dispatches the plugins but no output for my tests. My backend controller tests all extend this class which is responsible for setting up the backend test environment.</p>