Ejemplo n.º 1
0
 /**
  * Get the code coverage filter instance we will use for tests.
  * When running PHPUnit 3.5, this will return the singleton instance.
  * When running PHPUnit 3.6, this will return the instance we hold internally;
  * this same instance will be passed to PHPUnit in AgaviTesting::dispatch().
  *
  * @return     PHP_CodeCoverage_Filter The code coverage filter for our tests.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      1.0.7
  * @deprecated 1.1.0 Use AgaviPhpUnitCli
  */
 public static function getCodeCoverageFilter()
 {
     if (self::$codeCoverageFilter === null) {
         // PHP_CodeCoverage doesn't expose any version info, we'll have to check if there is a static getInstance method
         self::$codeCoverageFilter = method_exists('PHP_CodeCoverage_Filter', 'getInstance') ? PHP_CodeCoverage_Filter::getInstance() : new PHP_CodeCoverage_Filter();
     }
     return self::$codeCoverageFilter;
 }
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
0
// | 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']);