Beispiel #1
0
	/**
	 * Loads test suite
	 */
	public function before()
	{
		parent::before();

		if( ! Kohana_Tests::enabled())
		{
			// Pretend this is a normal 404 error...
			$this->status = 404;

			throw new Kohana_Request_Exception('Unable to find a route to match the URI: :uri',
				array(':uri' => $this->request->uri));
		}

		// Prevent the whitelist from being autoloaded, but allow the blacklist
		// to be laoded
		Kohana_Tests::configure_enviroment(FALSE);

		$this->config = Kohana::$config->load('phpunit');

		// This just stops some very very long lines
		$route = Route::get('unittest');
		$this->report_uri	= $route->uri(array('controller' => 'phpunit', 'action' => 'report'));
		$this->run_uri		= $route->uri(array('controller' => 'phpunit', 'action' => 'run'));

		// Switch used to disable cc settings
		$this->xdebug_loaded = extension_loaded('xdebug');
		$this->template->set_global('xdebug_enabled', $this->xdebug_loaded);
	}
Beispiel #2
0
<?php

// If we're on the CLI then PHPUnit will already be loaded
if (class_exists('PHPUnit_Util_Filter', FALSE)) {
    Kohana_Tests::configure_enviroment();
    // Stop kohana from processing the request
    define('SUPPRESS_REQUEST', TRUE);
} else {
    if (Kohana_Tests::enabled()) {
        // People shouldn't be running unit tests on their production server
        // so we assume that this /could/ be a web ui request on the dev server
        // and include phpunit so that modules can add specific files to the blacklist
        require_once 'PHPUnit/Framework.php';
    }
}
Route::set('unittest', '(phpunit(/<action>(/<id>)))')->defaults(array('controller' => 'phpunit', 'action' => 'index'));