Example #1
0
 /**
  * Creates the test suite for kohana
  *
  * @return Unittest_TestSuite
  */
 static function suite()
 {
     static $suite = NULL;
     if ($suite instanceof PHPUnit_Framework_TestSuite) {
         return $suite;
     }
     Unittest_Tests::configure_environment();
     $suite = new Unittest_TestSuite();
     // Load the whitelist and blacklist for code coverage
     $config = Kohana::$config->load('unittest');
     if ($config->use_whitelist) {
         $files = Unittest_Tests::whitelist(NULL, $suite);
     }
     if (count($config['blacklist'])) {
         Unittest_Tests::blacklist($config->blacklist, $suite);
     }
     // Add tests
     $files = Kohana::list_files('tests');
     $config = Kohana::$config->load('unittest');
     foreach ($config->test_blacklist as $bl) {
         unset($files[$bl]);
     }
     self::addTests($suite, $files);
     return $suite;
 }
Example #2
0
 /**
  * Creates the test suite for kohana
  *
  * @return PHPUnit_Framework_TestSuite
  */
 static function suite()
 {
     static $suite = NULL;
     if ($suite instanceof PHPUnit_Framework_TestSuite) {
         return $suite;
     }
     Unittest_Tests::configure_environment();
     $files = Kohana::list_files('tests');
     $suite = new PHPUnit_Framework_TestSuite();
     self::addTests($suite, $files);
     return $suite;
 }
Example #3
0
 /**
  * Loads test suite
  */
 public function before()
 {
     parent::before();
     if (!Unittest_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 loaded
     Unittest_Tests::configure_environment(FALSE);
     $this->config = Kohana::config('unittest');
     // This just stops some very very long lines
     $route = Route::get('unittest');
     $this->report_uri = $route->uri(array('action' => 'report'));
     $this->run_uri = $route->uri(array('action' => 'run'));
     // Switch used to disable cc settings
     $this->xdebug_loaded = extension_loaded('xdebug');
     $this->cc_archive_enabled = class_exists('Archive');
     Kohana_View::set_global('xdebug_enabled', $this->xdebug_loaded);
     Kohana_View::set_global('cc_archive_enabled', $this->cc_archive_enabled);
 }
Example #4
0
File: init.php Project: laiello/ko3
<?php

// If we're on the CLI then PHPUnit will already be loaded
if (class_exists('PHPUnit_Util_Filter', FALSE) or function_exists('phpunit_autoload')) {
    Unittest_Tests::configure_environment();
    // Stop kohana from processing the request
    define('SUPPRESS_REQUEST', TRUE);
}
Route::set('unittest', 'unittest(/<action>)')->defaults(array('controller' => 'unittest', 'action' => 'index'));