CodeView

PHPUnit test harness for Komodo

bootstrap.php

<?php
 
    /**
     * @author  Michael Heim
     * @link    http://www.zeilenwechsel.de/
     * @version 1.2.0
     * @license http://www.zeilenwechsel.de/it/code/browse/komodo-phpunit-harness/prod/license.txt
     */
 
    define( 'HARNESS_LOADER',                realpath( dirname( dirname( dirname( dirname( __file__ ) ) ) ) . '/prod/Utils/Loader.php' ) );
 
    define( 'INTEGRATION_TEST_DIR', realpath( dirname( dirname( __file__ ) ) ) );
 
    define( 'BASE_HELPERS_DIR',              realpath( INTEGRATION_TEST_DIR . '/tools/Base/helpers' ) );
    define( 'BASE_TASKS_DIR',                realpath( INTEGRATION_TEST_DIR . '/tools/Base/tasks' ) );
    define( 'KO_HELPERS_DIR',                realpath( INTEGRATION_TEST_DIR . '/tools/Ko/helpers' ) );
    define( 'KO_TASKS_DIR',                  realpath( INTEGRATION_TEST_DIR . '/tools/Ko/tasks' ) );
 
    define( 'BASE_RAW_OUTPUT_DIR',           INTEGRATION_TEST_DIR . '/reference-output/raw/Base' );
    define( 'KO_REFERENCE_OUTPUT_DIR',       INTEGRATION_TEST_DIR . '/reference-output/Ko' );
    define( 'KO_RAW_OUTPUT_DIR',             INTEGRATION_TEST_DIR . '/reference-output/raw/Ko' );
 
    define( 'INTEGRATION_TEST_RESOURCE_DIR',             realpath( INTEGRATION_TEST_DIR . '/resources' ) );
    define( 'INTEGRATION_TEST_XML_RESOURCE_DIR',         realpath( INTEGRATION_TEST_DIR . '/resources/xml' ) );
    define( 'INTEGRATION_TEST_XML_CUSTOM_RESOURCE_DIR',  realpath( INTEGRATION_TEST_DIR . '/resources/xml/custom-file' ) );
    define( 'INTEGRATION_TEST_XML_DEFAULT_RESOURCE_DIR', realpath( INTEGRATION_TEST_DIR . '/resources/xml/default-file' ) );
    define( 'INTEGRATION_TEST_XML_DIST_RESOURCE_DIR',    realpath( INTEGRATION_TEST_DIR . '/resources/xml/dist-file' ) );
 
    load_integration_test_helpers();
 
    /**
     * Requires all files (ie, classes) in the base and ko helper dirs.
     */
    function load_integration_test_helpers () {
 
        $helper_dirs = array( BASE_HELPERS_DIR, KO_HELPERS_DIR );
 
        foreach ( $helper_dirs as $dir ) set_include_path( get_include_path() . PATH_SEPARATOR . $dir );
 
        spl_autoload_register( 'case_sensitive_autoload' );
 
    }
 
    function case_sensitive_autoload ( $class ) {
 
        @include "$class.php";
 
    }
 
?>