2007-08-15 08:38:41 +02:00
|
|
|
<?php
|
2008-01-08 07:37:50 +01:00
|
|
|
/**
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage testing
|
|
|
|
*/
|
|
|
|
|
2007-08-15 12:01:35 +02:00
|
|
|
// Check that PHPUnit is installed
|
2008-03-19 21:38:52 +01:00
|
|
|
function hasPhpUnit() {
|
|
|
|
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));
|
|
|
|
foreach($paths as $path) {
|
|
|
|
if(@file_exists("$path/PHPUnit/Framework.php")) return true;
|
|
|
|
}
|
|
|
|
return false;
|
2007-08-15 12:01:35 +02:00
|
|
|
}
|
|
|
|
|
2008-01-09 05:18:36 +01:00
|
|
|
/**
|
|
|
|
*/
|
2008-03-19 21:38:52 +01:00
|
|
|
if(hasPhpUnit()) {
|
2007-08-15 08:38:41 +02:00
|
|
|
require_once 'PHPUnit/Framework.php';
|
2008-08-25 03:41:58 +02:00
|
|
|
require_once 'PHPUnit/Util/Report.php';
|
2007-08-15 08:38:41 +02:00
|
|
|
require_once 'PHPUnit/TextUI/TestRunner.php';
|
2008-03-19 21:38:52 +01:00
|
|
|
}
|
2007-08-15 08:38:41 +02:00
|
|
|
|
|
|
|
/**
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
* Controller that executes PHPUnit tests.
|
|
|
|
*
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package sapphire
|
|
|
|
* @subpackage testing
|
2007-08-15 08:38:41 +02:00
|
|
|
*/
|
|
|
|
class TestRunner extends Controller {
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
/** @ignore */
|
|
|
|
private static $default_reporter;
|
|
|
|
|
2008-08-09 06:06:52 +02:00
|
|
|
static $url_handlers = array(
|
2008-08-09 08:18:32 +02:00
|
|
|
'' => 'browse',
|
2008-08-25 03:41:58 +02:00
|
|
|
'coverage' => 'coverage',
|
2008-08-27 10:19:46 +02:00
|
|
|
'startsession' => 'startsession',
|
|
|
|
'endsession' => 'endsession',
|
2009-03-04 08:31:23 +01:00
|
|
|
'cleanupdb' => 'cleanupdb',
|
2008-08-09 08:18:32 +02:00
|
|
|
'$TestCase' => 'only',
|
2008-08-09 06:06:52 +02:00
|
|
|
);
|
|
|
|
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
/**
|
|
|
|
* Override the default reporter with a custom configured subclass.
|
|
|
|
*
|
|
|
|
* @param string $reporter
|
|
|
|
*/
|
|
|
|
static function set_reporter($reporter) {
|
|
|
|
if (is_string($reporter)) $reporter = new $reporter;
|
|
|
|
self::$default_reporter = $reporter;
|
|
|
|
}
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
parent::init();
|
2008-11-06 05:51:25 +01:00
|
|
|
ManifestBuilder::load_test_manifest();
|
2008-08-13 03:47:05 +02:00
|
|
|
if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView');
|
Merged revisions 53150,53681,53700,53820,54200,54459 via svnmerge from
svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/roa
........
r53150 | ischommer | 2008-04-22 11:12:43 +1200 (Tue, 22 Apr 2008) | 1 line
FEATURE Added a "test mode" for /db/build which allows mock-DataObject-subclasses which are just built in a test run
........
r53681 | mrickerby | 2008-04-29 15:26:52 +1200 (Tue, 29 Apr 2008) | 1 line
adding default wrapping header and footer methods, and configurable reporting to the TestRunner
........
r53700 | mrickerby | 2008-04-29 16:41:57 +1200 (Tue, 29 Apr 2008) | 1 line
FEATURE: adding support for /dev/tests --> DevelopmentAdmin-->tests() --> TestRunner, /dev/tasks --> DevelopmentAdmin-->tasks() --> TaskRunner
........
r53820 | mrickerby | 2008-04-30 19:27:52 +1200 (Wed, 30 Apr 2008) | 1 line
BUGFIX fixing up BuildTask interface and task runner action
........
r54200 | sminnee | 2008-05-09 00:28:44 +1200 (Fri, 09 May 2008) | 1 line
Added TestSession object to help with the testing of forms
........
r54459 | sminnee | 2008-05-13 17:28:25 +1200 (Tue, 13 May 2008) | 1 line
Added a basic menu of options to /dev
........
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@54456 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-05-13 07:57:09 +02:00
|
|
|
}
|
|
|
|
|
2008-08-09 08:40:50 +02:00
|
|
|
public function Link() {
|
|
|
|
return Controller::join_links(Director::absoluteBaseURL(), 'dev/tests/');
|
|
|
|
}
|
|
|
|
|
2007-08-16 08:35:27 +02:00
|
|
|
/**
|
|
|
|
* Run all test classes
|
|
|
|
*/
|
2008-08-09 08:18:32 +02:00
|
|
|
function all() {
|
2008-03-19 21:38:52 +01:00
|
|
|
if(hasPhpUnit()) {
|
|
|
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
|
|
|
array_shift($tests);
|
2008-05-15 10:46:40 +02:00
|
|
|
unset($tests['FunctionalTest']);
|
2007-08-15 08:38:41 +02:00
|
|
|
|
2008-03-19 21:38:52 +01:00
|
|
|
$this->runTests($tests);
|
|
|
|
} else {
|
|
|
|
echo "Please install PHPUnit using pear";
|
|
|
|
}
|
2007-08-16 08:35:27 +02:00
|
|
|
}
|
2008-05-26 08:21:30 +02:00
|
|
|
|
2008-08-09 08:18:32 +02:00
|
|
|
/**
|
|
|
|
* Browse all enabled test cases in the environment
|
|
|
|
*/
|
|
|
|
function browse() {
|
2008-08-09 08:40:50 +02:00
|
|
|
self::$default_reporter->writeHeader();
|
2008-11-09 16:34:29 +01:00
|
|
|
self::$default_reporter->writeInfo('Available Tests', false);
|
|
|
|
if(Director::is_cli()) {
|
|
|
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
|
|
|
$relativeLink = Director::makeRelative($this->Link());
|
|
|
|
echo "sake {$relativeLink}all: Run all " . count($tests) . " tests\n";
|
|
|
|
echo "sake {$relativeLink}coverage: Runs all tests and make test coverage report\n";
|
|
|
|
foreach ($tests as $test) {
|
|
|
|
echo "sake {$relativeLink}$test: Run $test\n";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo '<div class="trace">';
|
|
|
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
2008-12-04 23:38:32 +01:00
|
|
|
asort($tests);
|
2008-11-09 16:34:29 +01:00
|
|
|
echo "<h3><a href=\"" . $this->Link() . "all\">Run all " . count($tests) . " tests</a></h3>";
|
|
|
|
echo "<h3><a href=\"" . $this->Link() . "coverage\">Runs all tests and make test coverage report</a></h3>";
|
|
|
|
echo "<hr />";
|
|
|
|
foreach ($tests as $test) {
|
|
|
|
echo "<h3><a href=\"" . $this->Link() . "$test\">Run $test</a></h3>";
|
|
|
|
}
|
|
|
|
echo '</div>';
|
2008-08-09 08:18:32 +02:00
|
|
|
}
|
2008-11-09 16:34:29 +01:00
|
|
|
|
2008-08-09 08:40:50 +02:00
|
|
|
self::$default_reporter->writeFooter();
|
2008-08-09 08:18:32 +02:00
|
|
|
}
|
|
|
|
|
2008-05-26 08:21:30 +02:00
|
|
|
function coverage() {
|
|
|
|
if(hasPhpUnit()) {
|
2008-11-06 05:51:25 +01:00
|
|
|
ManifestBuilder::load_all_classes();
|
2008-05-26 08:21:30 +02:00
|
|
|
$tests = ClassInfo::subclassesFor('SapphireTest');
|
|
|
|
array_shift($tests);
|
|
|
|
unset($tests['FunctionalTest']);
|
|
|
|
|
|
|
|
$this->runTests($tests, true);
|
|
|
|
} else {
|
|
|
|
echo "Please install PHPUnit using pear";
|
|
|
|
}
|
|
|
|
}
|
2009-03-04 08:31:23 +01:00
|
|
|
|
|
|
|
function cleanupdb() {
|
|
|
|
SapphireTest::delete_all_temp_dbs();
|
|
|
|
}
|
2007-08-16 08:35:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Run only a single test class
|
|
|
|
*/
|
2008-08-09 06:06:52 +02:00
|
|
|
function only($request) {
|
|
|
|
$className = $request->param('TestCase');
|
2007-08-16 08:35:27 +02:00
|
|
|
if(class_exists($className)) {
|
2008-10-09 20:49:24 +02:00
|
|
|
if(!(singleton($className) instanceof SapphireTest)) {
|
|
|
|
user_error("TestRunner::only(): Invalid TestCase '$className', cannot find matching class", E_USER_ERROR);
|
|
|
|
}
|
2007-08-16 08:35:27 +02:00
|
|
|
$this->runTests(array($className));
|
|
|
|
} else {
|
2008-08-09 08:18:32 +02:00
|
|
|
if ($className == 'all') $this->all();
|
2007-08-16 08:35:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-26 08:21:30 +02:00
|
|
|
function runTests($classList, $coverage = false) {
|
2009-03-04 04:44:11 +01:00
|
|
|
// XDEBUG seem to cause problems with test execution :-(
|
|
|
|
if(function_exists('xdebug_disable')) xdebug_disable();
|
|
|
|
|
2008-11-10 06:06:23 +01:00
|
|
|
ini_set('max_execution_time', 0);
|
|
|
|
|
2008-08-13 04:47:14 +02:00
|
|
|
$this->setUp();
|
|
|
|
|
2008-08-11 01:03:35 +02:00
|
|
|
// run tests before outputting anything to the client
|
2007-08-15 08:38:41 +02:00
|
|
|
$suite = new PHPUnit_Framework_TestSuite();
|
2007-08-16 08:35:27 +02:00
|
|
|
foreach($classList as $className) {
|
2008-01-08 03:12:18 +01:00
|
|
|
// Ensure that the autoloader pulls in the test class, as PHPUnit won't know how to do this.
|
|
|
|
class_exists($className);
|
2007-08-16 08:35:27 +02:00
|
|
|
$suite->addTest(new PHPUnit_Framework_TestSuite($className));
|
2007-08-15 08:38:41 +02:00
|
|
|
}
|
2008-08-11 08:10:59 +02:00
|
|
|
|
|
|
|
// Remove the error handler so that PHPUnit can add its own
|
|
|
|
restore_error_handler();
|
|
|
|
|
2008-08-11 01:03:35 +02:00
|
|
|
/*, array("reportDirectory" => "/Users/sminnee/phpunit-report")*/
|
2008-08-13 03:47:05 +02:00
|
|
|
if(Director::is_cli()) $reporter = new CliTestReporter();
|
|
|
|
else $reporter = new SapphireTestReporter();
|
|
|
|
|
|
|
|
self::$default_reporter->writeHeader("Sapphire Test Runner");
|
|
|
|
if (count($classList) > 1) {
|
|
|
|
self::$default_reporter->writeInfo("All Tests", "Running test cases: " . implode(", ", $classList));
|
|
|
|
} else {
|
|
|
|
self::$default_reporter->writeInfo($classList[0], "");
|
|
|
|
}
|
|
|
|
|
2008-08-09 08:18:32 +02:00
|
|
|
$results = new PHPUnit_Framework_TestResult();
|
|
|
|
$results->addListener($reporter);
|
|
|
|
|
2008-05-26 08:21:30 +02:00
|
|
|
if($coverage) {
|
2008-08-25 03:41:58 +02:00
|
|
|
$results->collectCodeCoverageInformation(true);
|
2008-08-09 08:18:32 +02:00
|
|
|
$suite->run($results);
|
2008-08-25 03:41:58 +02:00
|
|
|
|
ENHANCEMENT Introduced constants for system paths like /sapphire in preparation for a more flexible directory reorganisation. Instead of hardcoding your path, please use the following constants: BASE_PATH, BASE_URL, SAPPHIRE_DIR, SAPPHIRE_PATH, CMS_DIR, CMS_PATH, THIRDPARTY_DIR, THIRDPARTY_PATH, ASSETS_DIR, ASSETS_PATH, THEMES_DIR, THEMES_PATH
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63154 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-09-27 18:02:38 +02:00
|
|
|
if(!file_exists(ASSETS_PATH . '/coverage-report')) mkdir(ASSETS_PATH . '/coverage-report');
|
|
|
|
PHPUnit_Util_Report::render($results, ASSETS_PATH . '/coverage-report/');
|
|
|
|
$coverageApp = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/','_',preg_replace('/(\/$)|(^\/)/','',Director::baseFolder())) . '.html';
|
|
|
|
$coverageTemplates = ASSETS_PATH . '/coverage-report/' . preg_replace('/[^A-Za-z0-9]/','_',preg_replace('/(\/$)|(^\/)/','',realpath(TEMP_FOLDER))) . '.html';
|
2008-08-25 03:41:58 +02:00
|
|
|
echo "<p>Coverage reports available here:<ul>
|
|
|
|
<li><a href=\"$coverageApp\">Coverage report of the application</a></li>
|
|
|
|
<li><a href=\"$coverageTemplates\">Coverage report of the templates</a></li>
|
|
|
|
</ul>";
|
2008-08-09 08:18:32 +02:00
|
|
|
} else {
|
|
|
|
$suite->run($results);
|
2008-05-26 08:21:30 +02:00
|
|
|
}
|
2008-05-15 10:46:40 +02:00
|
|
|
|
2008-09-23 05:22:13 +02:00
|
|
|
if(!Director::is_cli()) echo '<div class="trace">';
|
2008-08-09 08:18:32 +02:00
|
|
|
$reporter->writeResults();
|
|
|
|
|
2008-05-15 10:46:40 +02:00
|
|
|
if(!Director::is_cli()) echo '</div>';
|
2008-05-15 06:58:13 +02:00
|
|
|
|
|
|
|
// Put the error handlers back
|
|
|
|
Debug::loadErrorHandlers();
|
|
|
|
|
2008-05-15 10:46:40 +02:00
|
|
|
if(!Director::is_cli()) self::$default_reporter->writeFooter();
|
2008-08-13 03:47:05 +02:00
|
|
|
|
2008-08-13 04:47:14 +02:00
|
|
|
$this->tearDown();
|
|
|
|
|
2008-05-15 10:46:40 +02:00
|
|
|
// Todo: we should figure out how to pass this data back through Director more cleanly
|
2008-08-13 03:47:05 +02:00
|
|
|
if(Director::is_cli() && ($results->failureCount() + $results->errorCount()) > 0) exit(2);
|
2007-08-15 12:01:35 +02:00
|
|
|
}
|
2008-08-13 04:47:14 +02:00
|
|
|
|
2008-08-27 10:19:46 +02:00
|
|
|
/**
|
|
|
|
* Start a test session.
|
|
|
|
* Usage: visit dev/tests/startsession?fixture=(fixturefile). A test database will be constructed, and your browser session will be amended
|
|
|
|
* to use this database. This can only be run on dev and test sites.
|
|
|
|
*/
|
|
|
|
function startsession() {
|
|
|
|
if(!Director::isLive()) {
|
|
|
|
if(SapphireTest::using_temp_db()) {
|
|
|
|
$endLink = Director::baseURL() . "/dev/tests/endsession";
|
|
|
|
return "<p><a id=\"end-session\" href=\"$endLink\">You're in the middle of a test session; click here to end it.</a></p>";
|
|
|
|
|
|
|
|
} else if(!isset($_GET['fixture'])) {
|
|
|
|
$me = Director::baseURL() . "/dev/tests/startsession";
|
|
|
|
return <<<HTML
|
|
|
|
<form action="$me">
|
|
|
|
<p>Enter a fixture file name to start a new test session. Don't forget to visit dev/tests/endsession when you're done!</p>
|
|
|
|
<p>Fixture file: <input id="fixture-file" name="fixture" /></p>
|
|
|
|
<input type="hidden" name="flush" value="1">
|
|
|
|
<p><input id="start-session" value="Start test session" type="submit" /></p>
|
|
|
|
</form>
|
|
|
|
HTML;
|
|
|
|
} else {
|
|
|
|
$fixtureFile = $_GET['fixture'];
|
|
|
|
|
|
|
|
// Validate fixture file
|
|
|
|
$realFile = realpath('../' . $fixtureFile);
|
|
|
|
$baseDir = realpath(Director::baseFolder());
|
|
|
|
if(!$realFile || !file_exists($realFile)) {
|
|
|
|
return "<p>Fixture file doesn't exist</p>";
|
|
|
|
} else if(substr($realFile,0,strlen($baseDir)) != $baseDir) {
|
|
|
|
return "<p>Fixture file must be inside $baseDir</p>";
|
|
|
|
} else if(substr($realFile,-4) != '.yml') {
|
|
|
|
return "<p>Fixture file must be a .yml file</p>";
|
|
|
|
} else if(!preg_match('/^([^\/.][^\/]+)\/tests\//', $fixtureFile)) {
|
|
|
|
return "<p>Fixture file must be inside the tests subfolder of one of your modules.</p>";
|
|
|
|
}
|
|
|
|
|
|
|
|
$dbname = SapphireTest::create_temp_db();
|
2008-10-09 20:49:24 +02:00
|
|
|
|
2008-08-27 10:19:46 +02:00
|
|
|
DB::set_alternative_database_name($dbname);
|
|
|
|
|
|
|
|
$fixture = new YamlFixture($_GET['fixture']);
|
|
|
|
$fixture->saveIntoDatabase();
|
|
|
|
|
|
|
|
return "<p>Started testing session with fixture '$fixtureFile'. Time to start testing; where would you like to start?</p>
|
|
|
|
<ul>
|
|
|
|
<li><a id=\"home-link\" href=\"" .Director::baseURL() . "\">Homepage - published site</a></li>
|
|
|
|
<li><a id=\"draft-link\" href=\"" .Director::baseURL() . "?stage=Stage\">Homepage - draft site</a></li>
|
|
|
|
<li><a id=\"admin-link\" href=\"" .Director::baseURL() . "admin/\">CMS Admin</a></li>
|
|
|
|
</ul>";
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return "<p>startession can only be used on dev and test sites</p>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function endsession() {
|
|
|
|
SapphireTest::kill_temp_db();
|
|
|
|
DB::set_alternative_database_name(null);
|
|
|
|
|
|
|
|
return "<p>Test session ended.</p>";
|
|
|
|
}
|
|
|
|
|
2008-08-13 04:47:14 +02:00
|
|
|
function setUp() {
|
|
|
|
SapphireTest::create_temp_db();
|
2008-10-16 21:48:12 +02:00
|
|
|
SSViewer::flush_template_cache();
|
2008-08-13 04:47:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function tearDown() {
|
|
|
|
SapphireTest::kill_temp_db();
|
2009-02-03 22:17:23 +01:00
|
|
|
DB::set_alternative_database_name(null);
|
2008-08-13 04:47:14 +02:00
|
|
|
}
|
2007-08-15 12:01:35 +02:00
|
|
|
}
|
|
|
|
|
2008-01-10 01:33:18 +01:00
|
|
|
// This class is here to help with documentation.
|
2008-03-19 21:38:52 +01:00
|
|
|
if(!hasPhpUnit()) {
|
2008-01-10 01:33:18 +01:00
|
|
|
/**
|
|
|
|
* PHPUnit is a testing framework that can be installed using PEAR.
|
|
|
|
* It's not bundled with Sapphire, you will need to install it yourself.
|
|
|
|
*
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage testing
|
|
|
|
*/
|
|
|
|
class PHPUnit_Framework_TestCase {
|
|
|
|
|
|
|
|
}
|
2007-08-15 08:38:41 +02:00
|
|
|
}
|