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

  • Home
  • SEARCH
  • 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 5956065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:12:12+00:00 2026-05-22T18:12:12+00:00

I started out with models in a module called Api, using the following classname/filename

  • 0

I started out with models in a module called Api, using the following
classname/filename conventions:

filename:  {project}/application/modules/api/models/Account.php
classname: Api_Model_Account

They were happily autoloading through the framework as expected.

I decided that some of these models would be better off,
organisationally speaking, in the application’s models directory as they
could be used across multiple modules.

I moved them and renamed them:

filename:  {project}/application/models/Account.php
classname: Application_Model_Account

However, they are not autoloading – PHP throws a class not found. I have checked and confirmed my
configuration ({project}/application/configs/application.ini):

[production]
appnamespace = "Application"

So, the application namespace is ‘Application’, but the models in the
application/models directory are not being autoloaded.

Just to make things that little bit crazier – the plugins in application/plugins are being autoloaded.

Testing:

<?php

class Application_Model_ExampleTest extends AMH_Test_PHPUnit_ControllerTestCase
{
    public function testLoad()
    {
        $moduleModel = new Api_Model_Product();
        $plugin = new Application_Plugin_ModuleErrorControllerSelector();
        $applicationModel = new Application_Model_Example();
    }
}

class AMH_Test_PHPUnit_ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
{
    public function setUp()
    {
        $this->bootstrap = new Zend_Application(
            APPLICATION_ENV,
            APPLICATION_PATH . '/configs/application.ini'
        );

        parent::setUp();
    }

    public function tearDown()
    {
        $this->resetRequest();
        $this->resetResponse();

        parent::tearDown();
    }
}

Configuration:

[production]
appnamespace = "Application"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

includePaths.library = APPLICATION_PATH "/../library"

phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "Australia/Adelaide"


resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.displayExceptions = 0
resources.modules[] = ""

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

Relevant folder paths:

<project name>/
    application/
        models/
            Example.php
        modules/
            api/
                models/
                    Product.php
        plugins/
            ModuleErrorControllerSelector.php

Error message:

PHP Fatal error:  Class 'Application_Model_Example' not found in /var/www/accounts.amh.localhost/tests/application/models/ExampleTest.php on line 9

This is using Zend Framework 1.10 (package for Ubuntu 10.04)

  • 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-05-22T18:12:12+00:00Added an answer on May 22, 2026 at 6:12 pm

    This method needs to be in all tests to ensure the environment is properly bootstrapped:

    public function setUp()
    {
        $this->bootstrap = new Zend_Application(
            APPLICATION_ENV,
            APPLICATION_PATH . '/configs/application.ini'
        );
    
        parent::setUp();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started out using wordpress as a CMS. On the site I have
We had a test project that started out as MbUnit v3 / Gallio but
Ive inherited some code which started out as an Android project but really is
I started using Core Data for iPhone development. I started out by creating a
I've just started building a prototype application in Django. I started out by working
I'm getting started on building a REST API for a project I'm working on,
We have just started out with Team Foundation Server 2008 / Visual Studio Team
I have just started out with testing some php mvc framework In it, it
I just started out with a new site and I decided to use DOMImplementation
I just started out with C and have very little knowledge about performance issues

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.