Exemplo n.º 1
0
$agaviTestSettings = $GLOBALS['AGAVI_TESTING_ISOLATED_TEST_SETTINGS'];
unset($GLOBALS['AGAVI_TESTING_ISOLATED_TEST_SETTINGS']);
if ($agaviTestSettings['bootstrap'] || $agaviTestSettings['clearCache']) {
    require __DIR__ . '/../../testing.php';
}
if ($agaviTestSettings['bootstrap']) {
    // when agavi is not bootstrapped we don't want / need to load the agavi config
    // values from outside the isolation
    AgaviConfig::fromArray($GLOBALS['AGAVI_TESTING_CONFIG']);
}
unset($GLOBALS['AGAVI_TESTING_CONFIG']);
if ($agaviTestSettings['clearCache']) {
    AgaviToolkit::clearCache();
}
$env = null;
if ($agaviTestSettings['environment']) {
    $env = $agaviTestSettings['environment'];
}
if ($agaviTestSettings['bootstrap']) {
    AgaviTesting::bootstrap($env);
}
if ($agaviTestSettings['defaultContext']) {
    AgaviConfig::set('core.default_context', $agaviTestSettings['defaultContext']);
}
if (!defined('AGAVI_TESTING_BOOTSTRAPPED')) {
    // when PHPUnit runs with preserve global state enabled, AGAVI_TESTING_BOOTSTRAPPED will already be defined
    define('AGAVI_TESTING_BOOTSTRAPPED', true);
}
if (AGAVI_TESTING_ORIGINAL_PHPUNIT_BOOTSTRAP) {
    require_once AGAVI_TESTING_ORIGINAL_PHPUNIT_BOOTSTRAP;
}
// | Copyright (c) 2005-2011 the Agavi Project.                                |
// |                                                                           |
// | For the full copyright and license information, please view the LICENSE   |
// | file that was distributed with this source code. You can also view the    |
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
// |   vi: set noexpandtab:                                                    |
// |   Local Variables:                                                        |
// |   indent-tabs-mode: t                                                     |
// |   End:                                                                    |
// +---------------------------------------------------------------------------+
/**
 * PHPUnit bootstrap file for isolated tests
 *
 * @package    agavi
 * @subpackage testing
 *
 * @author     Felix Gilcher <*****@*****.**>
 * @copyright  The Agavi Project
 *
 * @since      1.0.0
 *
 * @version    $Id: AgaviBootstrap.tpl.php 4667 2011-05-20 12:34:58Z david $
 */
require_once 'testing.php';
AgaviConfig::fromArray($GLOBALS['AGAVI_CONFIG']);
unset($GLOBALS['AGAVI_CONFIG']);
if (!isset($GLOBALS['test.isolationEnvironment'])) {
    $GLOBALS['test.isolationEnvironment'] = null;
}
AgaviTesting::bootstrap($GLOBALS['test.isolationEnvironment']);