Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8451289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:11:54+00:00 2026-06-10T11:11:54+00:00

I have a library I’ve made for use with Zend Framework. In it, I

  • 0

I have a library I’ve made for use with Zend Framework. In it, I have Company/Controller/Action.php which all application controllers extend. It’s pretty simple and just injects some things into the controllers (like Doctrine’s entity manager).

I’m trying to get unit testing to work and have stumbled across an issue where I’m unable to get the bootstrap from within the Company_Controller_Action class (which extends Zend_Controller_Action):

function preDispatch() 
{
  $bootstrap = $this->getInvokeArg('bootstrap');
}

$bootstrap is null at this point. Anyone have any ideas why? I’ve verified that my bootstrap is being called and I can fetch the front controller, but I can’t get the bootstrap (through either getInvokeArg or the front controller).

This works in the normal production and development environments. The testing section of my application.ini just inherits from the production one, so it should be the same.

This is what I’m doing in my setUp():

public function setUp()
{
    $this->bootstrap = new Zend_Application(
        'testing',
        APPLICATION_PATH . '/configs/application.ini'
    );
    parent::setUp();
}

My Bootstrap.php:

<?php

// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

My phpunit.xml:

<phpunit bootstrap="./Bootstrap.php" colors="true">
    <testsuite name="Application Test Suite">
        <directory>./application</directory>
    </testsuite>
    <filter>
        <whitelist>
            <directory suffix=".php">../application/</directory>
            <exclude>
                <directory suffix=".php">../application/Entities</directory>
                <directory suffix=".php">../application/modules/default/views</directory>
                <file>../application/Bootstrap.php</file>
                <file>../application/modules/default/controllers/ErrorController.php</file>
            </exclude>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="./log/report" title="PrintConcept" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70" />
        <log type="testdox" target="./log/testdox.html" />
    </logging>
</phpunit>

Update: My $bootstrap is no longer null using the above configuration.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:11:56+00:00Added an answer on June 10, 2026 at 11:11 am

    This was a bug if I remember some few weeks ago which I saw in Zend bug trackers.

    Here is the fix which has worked for many:

    Initialize Front controller in your Bootstrap.php:

    protected function _initFrontController()
    {
    
        $frontControllerInstance = Zend_Controller_Front::getInstance();
    
        //If bootstrap is NULL or set to null then, set it.
        if(is_null($frontControllerInstance->getParam('bootstrap'))) {
            $frontControllerInstance->setParam('bootstrap', $this);
        }
        return $frontControllerInstance;
    }
    

    EDIT:

    I did a quick Google for the issue. I got a similar workaround (almost the same as I mentioned above) and also this answer on stackoverflow might help you, according to this answer it can be called via action helpers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have gdata library install on my ArchLinux, and a simple application which imports
We have a Library Project that we use for all our central reused code
So I have library called Engine.php and what it does basically is running example.com/controller/method/value
I have a questiom regarding the Zend Framework 2: I have library/System and library/Zend.
I have a library made in C++/GDI that I am trying to port to
I have a library written in C that I would like to use in
I have a library in C-language. is it possible to use it in C
I have a library of dubious origins which is identified by file as a
I have static library and another program which uses it. In the static library
I have a library android project Library (with activities and all) and a normal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.