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 7710139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:02:40+00:00 2026-06-01T01:02:40+00:00

I had become totally convinced about TDD and trying to use it by the

  • 0

I had become totally convinced about TDD and trying to use it by the book, looking forward to have a near to 100% test coverage and always writing tests before new coding.

I’m using phpUnit over ZF and although I can feel some progress somedays, in others I feel like I’m totally stuck.

My application is very database centric and I am in need to begin to test (and code…) database persistence.

I was taking a look at slides from Testing Lamp Appplications Presentation by Stephenn Bergmann and it seems very clear and straightforward how to test database interaction.

But, always I try to use a class that extends PHPUnit_Extensions_Database_TestCase I have error messages about not finding some class at ‘PHPUnit_Extensions_Database’ namespace.

Probably I´m missing some crucial point, as I have the same problem when I try to follow any of others solutions and suggestions I can find, like an answer and a presentation that I can’t link here because of my reputation…

In all cases, when I extends Database_TestCase, some class is not found.

I suspect that there is something related with the way I’m bootstraping, but I can’t find what I’m doing wrong. The tests I wrote that extend ControllerTestCase work well.

I’m running over Xampp. phpUnit version os 3.6.10, php is 5.3.8, Zend Framework is 1.11.11

I’m using the following phpunit.xml as php configuration:

<phpunit bootstrap="./application/bootstrap.php" colors="true">
<testsuite name="Some">
    <directory>./</directory>
</testsuite>

<filter>
    <whitelist>
        <directory suffix=".php">../application/</directory>
        <directory suffix=".php">../library/MyApp/</directory>
        <exclude>
            <directory suffix=".phtml">../application/</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" charset="UTF-8" yui="true" hightlight="true" lowupperbound="50" highlowerbound="80">
    <log type="testdox" target="./log/testdox.html">
</log></log></logging>

My Bootstrap.php is:

    error_reporting(E_ALL | E_STRICT);

// 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/Application.php';
require_once 'ControllerTestCase.php';

and ControllerTestCase.php

require_once 'Zend/Application.php';
require_once 'Zend/Test/PHPUnit/ControllerTestCase.php';
class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
{
    /**
     * @var Zend_Application
    */
    protected $application;

    public function setUp() {
        $this->bootstrap = array($this, 'appBootstrap');
        parent::setUp();
    }

    public function appBootstrap() {
        $this->application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
        $this->application->bootstrap();
    }
}

And when I create a Test as, for exemple, this tryTest.php

    require_once 'PHPUnit/Extensions/Database/TestCase.php';

class TryTest extends PHPUnit_Extensions_Database_TestCase {
    /*** any test or even just getConnection ***/
}

I receive the following error message or something close to it in other ways I try:

Fatal error: Class ‘PHPUnit_Extensions_Database_DefaultTester’ not found in C:\xampp\php\PEAR\PHPUnit\Extensions\Database\TestCase.php on
line 132

Call Stack:
0.0003 326968 1. {main}() C:\xampp\php\phpunit:0
0.0141 745152 2. PHPUnit_TextUI_Command::main() C:\xampp\php\phpunit:46
0.0141 745568 3. PHPUnit_TextUI_Command->run() C:\xampp\php\PEAR\PHPUnit\TextUI\Command.php:130
0.4012 5280032 4. PHPUnit_TextUI_TestRunner->doRun() C:\xampp\php\PEAR\PHPUnit\TextUI\Command.php:192
0.7182 5750296 5. PHPUnit_Framework_TestSuite->run() C:\xampp\php\PEAR\PHPUnit\TextUI\TestRunner.php:325
2.4058 11441872 6. PHPUnit_Framework_TestSuite->run() C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:705
2.4060 11442104 7. PHPUnit_Framework_TestSuite->runTest() C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:745
2.4060 11442104 8. PHPUnit_Framework_TestCase->run() C:\xampp\php\PEAR\PHPUnit\Framework\TestSuite.php:772
2.4061 11442104 9. PHPUnit_Framework_TestResult->run() C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:751
2.4066 11441136 10. PHPUnit_Framework_TestCase->runBare() C:\xampp\php\PEAR\PHPUnit\Framework\TestResult.php:649
2.4079 11494800 11. PHPUnit_Extensions_Database_TestCase->setUp()
C:\xampp\php\PEAR\PHPUnit\Framework\TestCase.php:801
2.4080 11494832 12. PHPUnit_Extensions_Database_TestCase->getDatabaseTester()
C:\xampp\php\PEAR\PHPUnit\Extensions\Database\TestCase.php:202
2.4080 11494832 13. PHPUnit_Extensions_Database_TestCase->newDatabaseTester()
C:\xampp\php\PEAR\PHPUnit\Extensions\Database\TestCase.php:92

There is a DefaultTester.php at C:\xampp\php\PEAR\PHPUnit\Extensions\Database and I can’t figure out what is going on…

I got to this configuration after following this [Zendcast from Jon Lebensold][2]. At that moment, I had some hard times trying to solve some problems, but after some help from @edorian I found that the main problem was between my chair and keyboard… :-/ Probably same situation now…

I even tryed to create a MapperTestCase in a similar way as Jon built his ControllerTestCase.php file, but this didn’t help me anyhow.

So, now I’m here, trying to get some help to find what is wrong with my environment or approach.

  • 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-01T01:02:42+00:00Added an answer on June 1, 2026 at 1:02 am

    Not really sure if it has solved all problems, but searching at Stackoverflow, I´d find this question that reported something similar to mine:

    require_once 'Zend/Loader/AutoLoader.php';
    $autoloader = Zend_Loader_AutoLoader::getInstance();
    $autoloader->registerNamespace('PHPUnit_');
    

    When I tried to put the code above at my bootstrap.php, I could at least make $connection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'mydb'); works

    I still can’t understand why PHPUnit extensions weren’t being find, but, at least I will can advance…

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

Sidebar

Related Questions

I had a strange coding situation where I needed to have the URI become
I'm seriously about to stop coding and become a carpenter. This problem has had
I have been building an iOS app and one of my ViewControllers had become
I have had multiple projects where the UI seems to become corrupt in the
I've had been hearing about test driven development for a couple years now, and
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had a debate about macros and their readability. I think that in some
I had a question in MySQL, did it correctly. But the book code differs
I'm working on a project at the moment and have become a little stuck.
I have recently become a teaching assistant for a university course which primarily teaches

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.