Hi,

I'm having problems running phpunit tests for my Zend application. I'm
wondering if anyone could correct what I'm doing wrong.

I've setup my application based on 
http://akrabat.com/2009/07/08/bootstrapping-modules-in-zf-1-8/ Rob Allen's
Bootstrapping Modules blog post. 

Note: right now I'm not trying to test controllers, just model classes

In my tests directory I have phpunit.xml and TestHelper.php
phpunit.xml
<phpunit bootstrap="./TestHelper.php" colors="true">
    <testsuite name="Zend Framework Unit Testing">
        <directory>.</directory>
    </testsuite>

    <filter>
        <whitelist>
            <directory suffix=".php">../library</directory>
            <directory suffix=".php">../application</directory>
            <exclude>
                <directory suffix=".phtml">../application</directory>
            </exclude>
        </whitelist>
    </filter>

</phpunit>

TestHelper.php
<?php
/**
 * Set the environment to be testing.
 */
define('APPLICATION_ENVIRONMENT', 'testing');

/**
 * Sets the application path constant for file inclusion.
 */
define('APPLICATION_PATH', realpath(dirname(dirname(__FILE__)) .
'/application/'));

/**
 * Make the library/ sub-folder an include path.
 */
set_include_path(
    APPLICATION_PATH . '/../library'
    . PATH_SEPARATOR . get_include_path()
);

echo get_include_path();

/**
 * Include the bootstrap file for testing - this is the same file used when
 * running the actual application.
 */
require_once '../application/bootstrap.php';
?>

My Bootstrap.php in application/
<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    protected function _initAutoload() {
        $moduleLoader = new Zend_Application_Module_Autoloader(array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH));
        return $moduleLoader;
    }
}
?>

When I run phpunit in the tests directory I get
Fatal error: Class 'Zend_Application_Bootstrap_Bootstrap' not found in
C:\code\myApp\application\Bootstrap.php on line 3

The include path echoed is:
C:\code\myApp\application/../library;.;C:\xampp\php\pear\

Thanks for any help.
-- 
View this message in context: 
http://n4.nabble.com/Bootstrapping-modules-and-testing-tp680333p680333.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to