Example #1
0
 public function tearDown()
 {
     if ($this->is_driver_active()) {
         $this->driver()->clear();
     }
     if ($this->is_environment_active()) {
         $this->environment()->restore();
     }
     if (in_array($this->driver_type(), array('kohana', 'simple'))) {
         Functest_Tests::rollback_transaction();
     } else {
         Functest_Tests::load_fixtures();
     }
     parent::tearDown();
 }
Example #2
0
 public static function suite()
 {
     if (!Functest_Tests::$_suite) {
         Functest_Tests::$_suite = new PHPUnit_Framework_TestSuite();
         Functest_Tests::$_suite->addTestFiles(Functest_Tests::tests());
     }
     return Functest_Tests::$_suite;
 }
Example #3
0
 public function test_suite()
 {
     $suite = Functest_Tests::suite();
     $suite2 = Functest_Tests::suite();
     $this->assertInstanceOf('PHPUnit_Framework_TestSuite', $suite);
     $this->assertSame($suite, $suite2);
 }
Example #4
0
    $system = DOCROOT . $system;
}
// Define the absolute paths for configured directories
define('APPPATH', realpath($application) . DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules) . DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system) . DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $system);
/**
 * Define the start time of the application, used for profiling.
 */
if (!defined('KOHANA_START_TIME')) {
    define('KOHANA_START_TIME', microtime(TRUE));
}
/**
 * Define the memory usage at the start of the application, used for profiling.
 */
if (!defined('KOHANA_START_MEMORY')) {
    define('KOHANA_START_MEMORY', memory_get_usage());
}
$_SERVER["PHP_APP_ENV"] = 'testing';
// Bootstrap the application
require APPPATH . 'bootstrap' . EXT;
Kohana::$environment = Kohana::TESTING;
// Disable output buffering
ob_end_flush();
// Enable the unittest module
Kohana::modules(Kohana::modules() + array('functest' => MODPATH . 'functest'));
Functest_Tests::enable_environment();
Functest_Tests::load_fixtures();