silverstripe-framework/dev/TestRunner.php

489 lines
15 KiB
PHP
Raw Normal View History

<?php
/**
* @package sapphire
* @subpackage testing
*/
/**
* Controller that executes PHPUnit tests.
*
* Alternatively, you can also use the "phpunit" binary directly by
* pointing it to a file or folder containing unit tests.
* See phpunit.dist.xml in the webroot for configuration details.
*
* <h2>URL Options</h2>
* - SkipTests: A comma-separated list of test classes to skip (useful when running dev/tests/all)
*
* See {@link browse()} output for generic usage instructions.
*
* @package sapphire
* @subpackage testing
*/
class TestRunner extends Controller {
/** @ignore */
private static $default_reporter;
static $url_handlers = array(
'' => 'browse',
'coverage/module/$ModuleName' => 'coverageModule',
'coverage/$TestCase!' => 'coverageOnly',
'coverage' => 'coverageAll',
'sessionloadyml' => 'sessionloadyml',
'startsession' => 'startsession',
'endsession' => 'endsession',
'cleanupdb' => 'cleanupdb',
'emptydb' => 'emptydb',
'module/$ModuleName' => 'module',
'all' => 'all',
'build' => 'build',
'$TestCase' => 'only',
);
static $allowed_actions = array(
'index',
'browse',
'coverage',
'startsession',
'endsession',
'cleanupdb',
'module',
'all',
'build',
'only'
);
Merge branch '2.4' Conflicts: cache/Cache.php cli/CliController.php core/Convert.php core/Core.php core/ManifestBuilder.php core/Object.php core/SSViewer.php core/control/ContentController.php core/control/ContentNegotiator.php core/control/FormResponse.php core/control/RequestHandler.php core/control/SilverStripeNavigatorItem.php core/i18n.php core/i18nTextCollector.php core/model/DataObjectSet.php core/model/Hierarchy.php core/model/Image.php core/model/MySQLDatabase.php core/model/SiteConfig.php core/model/SiteTree.php core/model/Translatable.php core/model/VirtualPage.php dev/Debug.php dev/SapphireTest.php dev/TestRunner.php dev/YamlFixture.php dev/install/MySQLDatabaseConfigurationHelper.php docs/en/installation/from-source.md docs/en/topics/themes.md docs/en/tutorials/4-site-search.md email/Mailer.php filesystem/File.php filesystem/Folder.php forms/ComplexTableField.php forms/CurrencyField.php forms/DateField.php forms/FieldSet.php forms/FileField.php forms/FileIFrameField.php forms/HtmlEditorConfig.php forms/HtmlEditorField.php forms/SelectionGroup.php forms/SimpleImageField.php forms/TabSet.php forms/TableField.php forms/TableListField.php forms/TreeDropdownField.php forms/TreeMultiselectField.php integration/Geoip.php javascript/SelectionGroup.js javascript/TreeSelectorField.js javascript/UpdateURL.js javascript/core/jquery.ondemand.js javascript/tiny_mce_improvements.js javascript/tree/tree.js lang/en_US.php search/ContentControllerSearchExtension.php security/Group.php security/Member.php security/PermissionCheckboxSetField.php security/PermissionRole.php security/Security.php static-main.php templates/RelationComplexTableField.ss templates/TableListField.ss tests/ConvertTest.php tests/DataObjectSetTest.php tests/DataObjectTest.php tests/DataObjectTest.yml tests/RequestHandlingTest.php tests/SSViewerTest.php tests/SiteTreePermissionsTest.php tests/SiteTreeTest.php tests/TransactionTest.php tests/api/RestfulServiceTest.php tests/control/DirectorTest.php tests/control/ModelAsControllerTest.php tests/fieldtypes/WidgetAreaEditorTest.php tests/forms/CurrencyFieldTest.php tests/forms/FormTest.php tests/model/DatabaseTest.php tests/model/ImageTest.php tests/search/ContentControllerSearchExtensionTest.php tests/security/MemberAuthenticatorTest.php thirdparty/.gitignore thirdparty/behaviour/behaviour.js thirdparty/firebug-lite/firebug.js thirdparty/firebug-lite/firebugx.js thirdparty/jquery-form/jquery.form.js thirdparty/jquery-livequery/jquery.livequery.js thirdparty/jquery-livequery/test/jquery.js thirdparty/jquery-livequery/test/test.html thirdparty/jquery-livequery/test/test2.html thirdparty/jquery-metadata/META.json thirdparty/jquery-metadata/README thirdparty/jquery-metadata/jquery.metadata.js thirdparty/jquery-metadata/test/index.html thirdparty/jquery-metadata/test/jquery.js thirdparty/jquery-metadata/test/test.js thirdparty/jquery-metadata/test/testrunner.js thirdparty/jquery-metadata/test/testsuite.css thirdparty/jquery-ui-themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_222222_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_2e83ff_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_454545_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_888888_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_cd0a0a_256x240.png thirdparty/jquery-ui/i18n/jquery-ui-i18n.js thirdparty/jquery-ui/i18n/ui.datepicker-ar.js thirdparty/jquery-ui/i18n/ui.datepicker-bg.js thirdparty/jquery-ui/i18n/ui.datepicker-ca.js thirdparty/jquery-ui/i18n/ui.datepicker-cs.js thirdparty/jquery-ui/i18n/ui.datepicker-da.js thirdparty/jquery-ui/i18n/ui.datepicker-de.js thirdparty/jquery-ui/i18n/ui.datepicker-el.js thirdparty/jquery-ui/i18n/ui.datepicker-eo.js thirdparty/jquery-ui/i18n/ui.datepicker-es.js thirdparty/jquery-ui/i18n/ui.datepicker-fa.js thirdparty/jquery-ui/i18n/ui.datepicker-fi.js thirdparty/jquery-ui/i18n/ui.datepicker-fr.js thirdparty/jquery-ui/i18n/ui.datepicker-he.js thirdparty/jquery-ui/i18n/ui.datepicker-hr.js thirdparty/jquery-ui/i18n/ui.datepicker-hu.js thirdparty/jquery-ui/i18n/ui.datepicker-hy.js thirdparty/jquery-ui/i18n/ui.datepicker-id.js thirdparty/jquery-ui/i18n/ui.datepicker-is.js thirdparty/jquery-ui/i18n/ui.datepicker-it.js thirdparty/jquery-ui/i18n/ui.datepicker-ja.js thirdparty/jquery-ui/i18n/ui.datepicker-ko.js thirdparty/jquery-ui/i18n/ui.datepicker-lt.js thirdparty/jquery-ui/i18n/ui.datepicker-lv.js thirdparty/jquery-ui/i18n/ui.datepicker-ms.js thirdparty/jquery-ui/i18n/ui.datepicker-nl.js thirdparty/jquery-ui/i18n/ui.datepicker-no.js thirdparty/jquery-ui/i18n/ui.datepicker-pl.js thirdparty/jquery-ui/i18n/ui.datepicker-pt-BR.js thirdparty/jquery-ui/i18n/ui.datepicker-ro.js thirdparty/jquery-ui/i18n/ui.datepicker-ru.js thirdparty/jquery-ui/i18n/ui.datepicker-sk.js thirdparty/jquery-ui/i18n/ui.datepicker-sl.js thirdparty/jquery-ui/i18n/ui.datepicker-sq.js thirdparty/jquery-ui/i18n/ui.datepicker-sr-SR.js thirdparty/jquery-ui/i18n/ui.datepicker-sr.js thirdparty/jquery-ui/i18n/ui.datepicker-sv.js thirdparty/jquery-ui/i18n/ui.datepicker-th.js thirdparty/jquery-ui/i18n/ui.datepicker-tr.js thirdparty/jquery-ui/i18n/ui.datepicker-uk.js thirdparty/jquery-ui/i18n/ui.datepicker-zh-CN.js thirdparty/jquery-ui/i18n/ui.datepicker-zh-TW.js thirdparty/jquery/jquery.js thirdparty/jsmin/.piston.yml thirdparty/jsmin/jsmin.php thirdparty/prototype/prototype.js thirdparty/scriptaculous/dragdrop.js thirdparty/simplepie/.piston.yml thirdparty/spyc/.piston.yml thirdparty/spyc/README thirdparty/spyc/php4/spyc.php4 thirdparty/spyc/php4/test.php4 thirdparty/spyc/spyc.php thirdparty/spyc/spyc.yaml thirdparty/tinymce-advcode/dialog.html thirdparty/tinymce-advcode/editor_plugin_src.js thirdparty/tinymce-advcode/js/dialog.js thirdparty/tinymce/langs/en.js thirdparty/tinymce/plugins/advhr/langs/en_dlg.js thirdparty/tinymce/plugins/advhr/rule.htm thirdparty/tinymce/plugins/advimage/image.htm thirdparty/tinymce/plugins/advimage/langs/en_dlg.js thirdparty/tinymce/plugins/advlink/langs/en_dlg.js thirdparty/tinymce/plugins/advlink/link.htm thirdparty/tinymce/plugins/emotions/emotions.htm thirdparty/tinymce/plugins/emotions/langs/en_dlg.js thirdparty/tinymce/plugins/example/dialog.htm thirdparty/tinymce/plugins/fullpage/fullpage.htm thirdparty/tinymce/plugins/fullpage/langs/en_dlg.js thirdparty/tinymce/plugins/fullscreen/fullscreen.htm thirdparty/tinymce/plugins/inlinepopups/template.htm thirdparty/tinymce/plugins/media/langs/en_dlg.js thirdparty/tinymce/plugins/media/media.htm thirdparty/tinymce/plugins/paste/js/pasteword.js thirdparty/tinymce/plugins/paste/langs/en_dlg.js thirdparty/tinymce/plugins/paste/pastetext.htm thirdparty/tinymce/plugins/paste/pasteword.htm thirdparty/tinymce/plugins/searchreplace/langs/en_dlg.js thirdparty/tinymce/plugins/searchreplace/searchreplace.htm thirdparty/tinymce/plugins/spellchecker/editor_plugin.js thirdparty/tinymce/plugins/spellchecker/editor_plugin_src.js thirdparty/tinymce/plugins/style/langs/en_dlg.js thirdparty/tinymce/plugins/style/props.htm thirdparty/tinymce/plugins/table/cell.htm thirdparty/tinymce/plugins/table/langs/en_dlg.js thirdparty/tinymce/plugins/table/merge_cells.htm thirdparty/tinymce/plugins/table/row.htm thirdparty/tinymce/plugins/table/table.htm thirdparty/tinymce/plugins/template/langs/en_dlg.js thirdparty/tinymce/plugins/template/template.htm thirdparty/tinymce/plugins/xhtmlxtras/abbr.htm thirdparty/tinymce/plugins/xhtmlxtras/acronym.htm thirdparty/tinymce/plugins/xhtmlxtras/attributes.htm thirdparty/tinymce/plugins/xhtmlxtras/cite.htm thirdparty/tinymce/plugins/xhtmlxtras/del.htm thirdparty/tinymce/plugins/xhtmlxtras/ins.htm thirdparty/tinymce/plugins/xhtmlxtras/langs/en_dlg.js thirdparty/tinymce/themes/advanced/about.htm thirdparty/tinymce/themes/advanced/anchor.htm thirdparty/tinymce/themes/advanced/charmap.htm thirdparty/tinymce/themes/advanced/color_picker.htm thirdparty/tinymce/themes/advanced/image.htm thirdparty/tinymce/themes/advanced/langs/en.js thirdparty/tinymce/themes/advanced/langs/en_dlg.js thirdparty/tinymce/themes/advanced/link.htm thirdparty/tinymce/themes/advanced/source_editor.htm thirdparty/tinymce/themes/simple/langs/en.js thirdparty/tinymce/tiny_mce.js thirdparty/tinymce/tiny_mce_src.js widgets/Widget.php
2011-02-14 06:47:53 +01:00
/**
* @var Array Blacklist certain directories for the coverage report.
* Filepaths are relative to the webroot, without leading slash.
*
* @see http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.blacklist-whitelist
*/
static $coverage_filter_dirs = array(
'cms/thirdparty',
'cms/tests',
'cms/lang',
'sapphire/thirdparty',
'sapphire/tests',
'sapphire/lang',
);
/**
* @var Array Blacklist certain directories for the coverage report.
* Filepaths are relative to the webroot, without leading slash.
*
* @see http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.blacklist-whitelist
*/
static $coverage_filter_dirs = array(
'cms/thirdparty',
'cms/tests',
'cms/lang',
'sapphire/thirdparty',
'sapphire/tests',
'sapphire/lang',
);
/**
* 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();
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
if(!$canAccess) return Security::permissionFailure($this);
if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView');
if(!PhpUnitWrapper::has_php_unit()) {
die("Please install PHPUnit using pear");
}
}
public function Link() {
return Controller::join_links(Director::absoluteBaseURL(), 'dev/tests/');
}
/**
* Run test classes that should be run with every commit.
* Currently excludes PhpSyntaxTest
*/
function all($request, $coverage = false) {
ManifestBuilder::load_test_manifest();
$tests = ClassInfo::subclassesFor('SapphireTest');
array_shift($tests);
unset($tests['FunctionalTest']);
// Remove tests that don't need to be executed every time
unset($tests['PhpSyntaxTest']);
foreach($tests as $class => $v) {
$reflection = new ReflectionClass($class);
if(!$reflection->isInstantiable()) unset($tests[$class]);
}
$this->runTests($tests, $coverage);
}
/**
* Run test classes that should be run before build - i.e., everything possible.
*/
function build() {
ManifestBuilder::load_test_manifest();
$tests = ClassInfo::subclassesFor('SapphireTest');
array_shift($tests);
unset($tests['FunctionalTest']);
foreach($tests as $class => $v) {
$reflection = new ReflectionClass($class);
if(!$reflection->isInstantiable()) unset($tests[$class]);
}
$this->runTests($tests);
}
/**
* Browse all enabled test cases in the environment
*/
function browse() {
ManifestBuilder::load_test_manifest();
self::$default_reporter->writeHeader();
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";
echo "sake {$relativeLink}module/<modulename>: Runs all tests in a module folder\n";
foreach ($tests as $test) {
echo "sake {$relativeLink}$test: Run $test\n";
}
} else {
echo '<div class="trace">';
$tests = ClassInfo::subclassesFor('SapphireTest');
asort($tests);
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>';
}
self::$default_reporter->writeFooter();
}
/**
* Run a coverage test across all modules
*/
function coverageAll($request) {
ManifestBuilder::load_all_classes();
$this->all($request, true);
}
Merge branch '2.4' Conflicts: cache/Cache.php cli/CliController.php core/Convert.php core/Core.php core/ManifestBuilder.php core/Object.php core/SSViewer.php core/control/ContentController.php core/control/ContentNegotiator.php core/control/FormResponse.php core/control/RequestHandler.php core/control/SilverStripeNavigatorItem.php core/i18n.php core/i18nTextCollector.php core/model/DataObjectSet.php core/model/Hierarchy.php core/model/Image.php core/model/MySQLDatabase.php core/model/SiteConfig.php core/model/SiteTree.php core/model/Translatable.php core/model/VirtualPage.php dev/Debug.php dev/SapphireTest.php dev/TestRunner.php dev/YamlFixture.php dev/install/MySQLDatabaseConfigurationHelper.php docs/en/installation/from-source.md docs/en/topics/themes.md docs/en/tutorials/4-site-search.md email/Mailer.php filesystem/File.php filesystem/Folder.php forms/ComplexTableField.php forms/CurrencyField.php forms/DateField.php forms/FieldSet.php forms/FileField.php forms/FileIFrameField.php forms/HtmlEditorConfig.php forms/HtmlEditorField.php forms/SelectionGroup.php forms/SimpleImageField.php forms/TabSet.php forms/TableField.php forms/TableListField.php forms/TreeDropdownField.php forms/TreeMultiselectField.php integration/Geoip.php javascript/SelectionGroup.js javascript/TreeSelectorField.js javascript/UpdateURL.js javascript/core/jquery.ondemand.js javascript/tiny_mce_improvements.js javascript/tree/tree.js lang/en_US.php search/ContentControllerSearchExtension.php security/Group.php security/Member.php security/PermissionCheckboxSetField.php security/PermissionRole.php security/Security.php static-main.php templates/RelationComplexTableField.ss templates/TableListField.ss tests/ConvertTest.php tests/DataObjectSetTest.php tests/DataObjectTest.php tests/DataObjectTest.yml tests/RequestHandlingTest.php tests/SSViewerTest.php tests/SiteTreePermissionsTest.php tests/SiteTreeTest.php tests/TransactionTest.php tests/api/RestfulServiceTest.php tests/control/DirectorTest.php tests/control/ModelAsControllerTest.php tests/fieldtypes/WidgetAreaEditorTest.php tests/forms/CurrencyFieldTest.php tests/forms/FormTest.php tests/model/DatabaseTest.php tests/model/ImageTest.php tests/search/ContentControllerSearchExtensionTest.php tests/security/MemberAuthenticatorTest.php thirdparty/.gitignore thirdparty/behaviour/behaviour.js thirdparty/firebug-lite/firebug.js thirdparty/firebug-lite/firebugx.js thirdparty/jquery-form/jquery.form.js thirdparty/jquery-livequery/jquery.livequery.js thirdparty/jquery-livequery/test/jquery.js thirdparty/jquery-livequery/test/test.html thirdparty/jquery-livequery/test/test2.html thirdparty/jquery-metadata/META.json thirdparty/jquery-metadata/README thirdparty/jquery-metadata/jquery.metadata.js thirdparty/jquery-metadata/test/index.html thirdparty/jquery-metadata/test/jquery.js thirdparty/jquery-metadata/test/test.js thirdparty/jquery-metadata/test/testrunner.js thirdparty/jquery-metadata/test/testsuite.css thirdparty/jquery-ui-themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_222222_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_2e83ff_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_454545_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_888888_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_cd0a0a_256x240.png thirdparty/jquery-ui/i18n/jquery-ui-i18n.js thirdparty/jquery-ui/i18n/ui.datepicker-ar.js thirdparty/jquery-ui/i18n/ui.datepicker-bg.js thirdparty/jquery-ui/i18n/ui.datepicker-ca.js thirdparty/jquery-ui/i18n/ui.datepicker-cs.js thirdparty/jquery-ui/i18n/ui.datepicker-da.js thirdparty/jquery-ui/i18n/ui.datepicker-de.js thirdparty/jquery-ui/i18n/ui.datepicker-el.js thirdparty/jquery-ui/i18n/ui.datepicker-eo.js thirdparty/jquery-ui/i18n/ui.datepicker-es.js thirdparty/jquery-ui/i18n/ui.datepicker-fa.js thirdparty/jquery-ui/i18n/ui.datepicker-fi.js thirdparty/jquery-ui/i18n/ui.datepicker-fr.js thirdparty/jquery-ui/i18n/ui.datepicker-he.js thirdparty/jquery-ui/i18n/ui.datepicker-hr.js thirdparty/jquery-ui/i18n/ui.datepicker-hu.js thirdparty/jquery-ui/i18n/ui.datepicker-hy.js thirdparty/jquery-ui/i18n/ui.datepicker-id.js thirdparty/jquery-ui/i18n/ui.datepicker-is.js thirdparty/jquery-ui/i18n/ui.datepicker-it.js thirdparty/jquery-ui/i18n/ui.datepicker-ja.js thirdparty/jquery-ui/i18n/ui.datepicker-ko.js thirdparty/jquery-ui/i18n/ui.datepicker-lt.js thirdparty/jquery-ui/i18n/ui.datepicker-lv.js thirdparty/jquery-ui/i18n/ui.datepicker-ms.js thirdparty/jquery-ui/i18n/ui.datepicker-nl.js thirdparty/jquery-ui/i18n/ui.datepicker-no.js thirdparty/jquery-ui/i18n/ui.datepicker-pl.js thirdparty/jquery-ui/i18n/ui.datepicker-pt-BR.js thirdparty/jquery-ui/i18n/ui.datepicker-ro.js thirdparty/jquery-ui/i18n/ui.datepicker-ru.js thirdparty/jquery-ui/i18n/ui.datepicker-sk.js thirdparty/jquery-ui/i18n/ui.datepicker-sl.js thirdparty/jquery-ui/i18n/ui.datepicker-sq.js thirdparty/jquery-ui/i18n/ui.datepicker-sr-SR.js thirdparty/jquery-ui/i18n/ui.datepicker-sr.js thirdparty/jquery-ui/i18n/ui.datepicker-sv.js thirdparty/jquery-ui/i18n/ui.datepicker-th.js thirdparty/jquery-ui/i18n/ui.datepicker-tr.js thirdparty/jquery-ui/i18n/ui.datepicker-uk.js thirdparty/jquery-ui/i18n/ui.datepicker-zh-CN.js thirdparty/jquery-ui/i18n/ui.datepicker-zh-TW.js thirdparty/jquery/jquery.js thirdparty/jsmin/.piston.yml thirdparty/jsmin/jsmin.php thirdparty/prototype/prototype.js thirdparty/scriptaculous/dragdrop.js thirdparty/simplepie/.piston.yml thirdparty/spyc/.piston.yml thirdparty/spyc/README thirdparty/spyc/php4/spyc.php4 thirdparty/spyc/php4/test.php4 thirdparty/spyc/spyc.php thirdparty/spyc/spyc.yaml thirdparty/tinymce-advcode/dialog.html thirdparty/tinymce-advcode/editor_plugin_src.js thirdparty/tinymce-advcode/js/dialog.js thirdparty/tinymce/langs/en.js thirdparty/tinymce/plugins/advhr/langs/en_dlg.js thirdparty/tinymce/plugins/advhr/rule.htm thirdparty/tinymce/plugins/advimage/image.htm thirdparty/tinymce/plugins/advimage/langs/en_dlg.js thirdparty/tinymce/plugins/advlink/langs/en_dlg.js thirdparty/tinymce/plugins/advlink/link.htm thirdparty/tinymce/plugins/emotions/emotions.htm thirdparty/tinymce/plugins/emotions/langs/en_dlg.js thirdparty/tinymce/plugins/example/dialog.htm thirdparty/tinymce/plugins/fullpage/fullpage.htm thirdparty/tinymce/plugins/fullpage/langs/en_dlg.js thirdparty/tinymce/plugins/fullscreen/fullscreen.htm thirdparty/tinymce/plugins/inlinepopups/template.htm thirdparty/tinymce/plugins/media/langs/en_dlg.js thirdparty/tinymce/plugins/media/media.htm thirdparty/tinymce/plugins/paste/js/pasteword.js thirdparty/tinymce/plugins/paste/langs/en_dlg.js thirdparty/tinymce/plugins/paste/pastetext.htm thirdparty/tinymce/plugins/paste/pasteword.htm thirdparty/tinymce/plugins/searchreplace/langs/en_dlg.js thirdparty/tinymce/plugins/searchreplace/searchreplace.htm thirdparty/tinymce/plugins/spellchecker/editor_plugin.js thirdparty/tinymce/plugins/spellchecker/editor_plugin_src.js thirdparty/tinymce/plugins/style/langs/en_dlg.js thirdparty/tinymce/plugins/style/props.htm thirdparty/tinymce/plugins/table/cell.htm thirdparty/tinymce/plugins/table/langs/en_dlg.js thirdparty/tinymce/plugins/table/merge_cells.htm thirdparty/tinymce/plugins/table/row.htm thirdparty/tinymce/plugins/table/table.htm thirdparty/tinymce/plugins/template/langs/en_dlg.js thirdparty/tinymce/plugins/template/template.htm thirdparty/tinymce/plugins/xhtmlxtras/abbr.htm thirdparty/tinymce/plugins/xhtmlxtras/acronym.htm thirdparty/tinymce/plugins/xhtmlxtras/attributes.htm thirdparty/tinymce/plugins/xhtmlxtras/cite.htm thirdparty/tinymce/plugins/xhtmlxtras/del.htm thirdparty/tinymce/plugins/xhtmlxtras/ins.htm thirdparty/tinymce/plugins/xhtmlxtras/langs/en_dlg.js thirdparty/tinymce/themes/advanced/about.htm thirdparty/tinymce/themes/advanced/anchor.htm thirdparty/tinymce/themes/advanced/charmap.htm thirdparty/tinymce/themes/advanced/color_picker.htm thirdparty/tinymce/themes/advanced/image.htm thirdparty/tinymce/themes/advanced/langs/en.js thirdparty/tinymce/themes/advanced/langs/en_dlg.js thirdparty/tinymce/themes/advanced/link.htm thirdparty/tinymce/themes/advanced/source_editor.htm thirdparty/tinymce/themes/simple/langs/en.js thirdparty/tinymce/tiny_mce.js thirdparty/tinymce/tiny_mce_src.js widgets/Widget.php
2011-02-14 06:47:53 +01:00
<<<<<<< HEAD
/**
* Run only a single coverage test class or a comma-separated list of tests
*/
function coverageOnly($request) {
$this->only($request, true);
}
/**
=======
/**
* Run only a single coverage test class or a comma-separated list of tests
*/
function coverageOnly($request) {
$this->only($request, true);
}
/**
Merge branch '2.4' Conflicts: cache/Cache.php cli/CliController.php core/Convert.php core/Core.php core/ManifestBuilder.php core/Object.php core/SSViewer.php core/control/ContentController.php core/control/ContentNegotiator.php core/control/FormResponse.php core/control/RequestHandler.php core/control/SilverStripeNavigatorItem.php core/i18n.php core/i18nTextCollector.php core/model/DataObjectSet.php core/model/Hierarchy.php core/model/Image.php core/model/MySQLDatabase.php core/model/SiteConfig.php core/model/SiteTree.php core/model/Translatable.php core/model/VirtualPage.php dev/Debug.php dev/SapphireTest.php dev/TestRunner.php dev/YamlFixture.php dev/install/MySQLDatabaseConfigurationHelper.php docs/en/installation/from-source.md docs/en/topics/themes.md docs/en/tutorials/4-site-search.md email/Mailer.php filesystem/File.php filesystem/Folder.php forms/ComplexTableField.php forms/CurrencyField.php forms/DateField.php forms/FieldSet.php forms/FileField.php forms/FileIFrameField.php forms/HtmlEditorConfig.php forms/HtmlEditorField.php forms/SelectionGroup.php forms/SimpleImageField.php forms/TabSet.php forms/TableField.php forms/TableListField.php forms/TreeDropdownField.php forms/TreeMultiselectField.php integration/Geoip.php javascript/SelectionGroup.js javascript/TreeSelectorField.js javascript/UpdateURL.js javascript/core/jquery.ondemand.js javascript/tiny_mce_improvements.js javascript/tree/tree.js lang/en_US.php search/ContentControllerSearchExtension.php security/Group.php security/Member.php security/PermissionCheckboxSetField.php security/PermissionRole.php security/Security.php static-main.php templates/RelationComplexTableField.ss templates/TableListField.ss tests/ConvertTest.php tests/DataObjectSetTest.php tests/DataObjectTest.php tests/DataObjectTest.yml tests/RequestHandlingTest.php tests/SSViewerTest.php tests/SiteTreePermissionsTest.php tests/SiteTreeTest.php tests/TransactionTest.php tests/api/RestfulServiceTest.php tests/control/DirectorTest.php tests/control/ModelAsControllerTest.php tests/fieldtypes/WidgetAreaEditorTest.php tests/forms/CurrencyFieldTest.php tests/forms/FormTest.php tests/model/DatabaseTest.php tests/model/ImageTest.php tests/search/ContentControllerSearchExtensionTest.php tests/security/MemberAuthenticatorTest.php thirdparty/.gitignore thirdparty/behaviour/behaviour.js thirdparty/firebug-lite/firebug.js thirdparty/firebug-lite/firebugx.js thirdparty/jquery-form/jquery.form.js thirdparty/jquery-livequery/jquery.livequery.js thirdparty/jquery-livequery/test/jquery.js thirdparty/jquery-livequery/test/test.html thirdparty/jquery-livequery/test/test2.html thirdparty/jquery-metadata/META.json thirdparty/jquery-metadata/README thirdparty/jquery-metadata/jquery.metadata.js thirdparty/jquery-metadata/test/index.html thirdparty/jquery-metadata/test/jquery.js thirdparty/jquery-metadata/test/test.js thirdparty/jquery-metadata/test/testrunner.js thirdparty/jquery-metadata/test/testsuite.css thirdparty/jquery-ui-themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png thirdparty/jquery-ui-themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_222222_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_2e83ff_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_454545_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_888888_256x240.png thirdparty/jquery-ui-themes/smoothness/images/ui-icons_cd0a0a_256x240.png thirdparty/jquery-ui/i18n/jquery-ui-i18n.js thirdparty/jquery-ui/i18n/ui.datepicker-ar.js thirdparty/jquery-ui/i18n/ui.datepicker-bg.js thirdparty/jquery-ui/i18n/ui.datepicker-ca.js thirdparty/jquery-ui/i18n/ui.datepicker-cs.js thirdparty/jquery-ui/i18n/ui.datepicker-da.js thirdparty/jquery-ui/i18n/ui.datepicker-de.js thirdparty/jquery-ui/i18n/ui.datepicker-el.js thirdparty/jquery-ui/i18n/ui.datepicker-eo.js thirdparty/jquery-ui/i18n/ui.datepicker-es.js thirdparty/jquery-ui/i18n/ui.datepicker-fa.js thirdparty/jquery-ui/i18n/ui.datepicker-fi.js thirdparty/jquery-ui/i18n/ui.datepicker-fr.js thirdparty/jquery-ui/i18n/ui.datepicker-he.js thirdparty/jquery-ui/i18n/ui.datepicker-hr.js thirdparty/jquery-ui/i18n/ui.datepicker-hu.js thirdparty/jquery-ui/i18n/ui.datepicker-hy.js thirdparty/jquery-ui/i18n/ui.datepicker-id.js thirdparty/jquery-ui/i18n/ui.datepicker-is.js thirdparty/jquery-ui/i18n/ui.datepicker-it.js thirdparty/jquery-ui/i18n/ui.datepicker-ja.js thirdparty/jquery-ui/i18n/ui.datepicker-ko.js thirdparty/jquery-ui/i18n/ui.datepicker-lt.js thirdparty/jquery-ui/i18n/ui.datepicker-lv.js thirdparty/jquery-ui/i18n/ui.datepicker-ms.js thirdparty/jquery-ui/i18n/ui.datepicker-nl.js thirdparty/jquery-ui/i18n/ui.datepicker-no.js thirdparty/jquery-ui/i18n/ui.datepicker-pl.js thirdparty/jquery-ui/i18n/ui.datepicker-pt-BR.js thirdparty/jquery-ui/i18n/ui.datepicker-ro.js thirdparty/jquery-ui/i18n/ui.datepicker-ru.js thirdparty/jquery-ui/i18n/ui.datepicker-sk.js thirdparty/jquery-ui/i18n/ui.datepicker-sl.js thirdparty/jquery-ui/i18n/ui.datepicker-sq.js thirdparty/jquery-ui/i18n/ui.datepicker-sr-SR.js thirdparty/jquery-ui/i18n/ui.datepicker-sr.js thirdparty/jquery-ui/i18n/ui.datepicker-sv.js thirdparty/jquery-ui/i18n/ui.datepicker-th.js thirdparty/jquery-ui/i18n/ui.datepicker-tr.js thirdparty/jquery-ui/i18n/ui.datepicker-uk.js thirdparty/jquery-ui/i18n/ui.datepicker-zh-CN.js thirdparty/jquery-ui/i18n/ui.datepicker-zh-TW.js thirdparty/jquery/jquery.js thirdparty/jsmin/.piston.yml thirdparty/jsmin/jsmin.php thirdparty/prototype/prototype.js thirdparty/scriptaculous/dragdrop.js thirdparty/simplepie/.piston.yml thirdparty/spyc/.piston.yml thirdparty/spyc/README thirdparty/spyc/php4/spyc.php4 thirdparty/spyc/php4/test.php4 thirdparty/spyc/spyc.php thirdparty/spyc/spyc.yaml thirdparty/tinymce-advcode/dialog.html thirdparty/tinymce-advcode/editor_plugin_src.js thirdparty/tinymce-advcode/js/dialog.js thirdparty/tinymce/langs/en.js thirdparty/tinymce/plugins/advhr/langs/en_dlg.js thirdparty/tinymce/plugins/advhr/rule.htm thirdparty/tinymce/plugins/advimage/image.htm thirdparty/tinymce/plugins/advimage/langs/en_dlg.js thirdparty/tinymce/plugins/advlink/langs/en_dlg.js thirdparty/tinymce/plugins/advlink/link.htm thirdparty/tinymce/plugins/emotions/emotions.htm thirdparty/tinymce/plugins/emotions/langs/en_dlg.js thirdparty/tinymce/plugins/example/dialog.htm thirdparty/tinymce/plugins/fullpage/fullpage.htm thirdparty/tinymce/plugins/fullpage/langs/en_dlg.js thirdparty/tinymce/plugins/fullscreen/fullscreen.htm thirdparty/tinymce/plugins/inlinepopups/template.htm thirdparty/tinymce/plugins/media/langs/en_dlg.js thirdparty/tinymce/plugins/media/media.htm thirdparty/tinymce/plugins/paste/js/pasteword.js thirdparty/tinymce/plugins/paste/langs/en_dlg.js thirdparty/tinymce/plugins/paste/pastetext.htm thirdparty/tinymce/plugins/paste/pasteword.htm thirdparty/tinymce/plugins/searchreplace/langs/en_dlg.js thirdparty/tinymce/plugins/searchreplace/searchreplace.htm thirdparty/tinymce/plugins/spellchecker/editor_plugin.js thirdparty/tinymce/plugins/spellchecker/editor_plugin_src.js thirdparty/tinymce/plugins/style/langs/en_dlg.js thirdparty/tinymce/plugins/style/props.htm thirdparty/tinymce/plugins/table/cell.htm thirdparty/tinymce/plugins/table/langs/en_dlg.js thirdparty/tinymce/plugins/table/merge_cells.htm thirdparty/tinymce/plugins/table/row.htm thirdparty/tinymce/plugins/table/table.htm thirdparty/tinymce/plugins/template/langs/en_dlg.js thirdparty/tinymce/plugins/template/template.htm thirdparty/tinymce/plugins/xhtmlxtras/abbr.htm thirdparty/tinymce/plugins/xhtmlxtras/acronym.htm thirdparty/tinymce/plugins/xhtmlxtras/attributes.htm thirdparty/tinymce/plugins/xhtmlxtras/cite.htm thirdparty/tinymce/plugins/xhtmlxtras/del.htm thirdparty/tinymce/plugins/xhtmlxtras/ins.htm thirdparty/tinymce/plugins/xhtmlxtras/langs/en_dlg.js thirdparty/tinymce/themes/advanced/about.htm thirdparty/tinymce/themes/advanced/anchor.htm thirdparty/tinymce/themes/advanced/charmap.htm thirdparty/tinymce/themes/advanced/color_picker.htm thirdparty/tinymce/themes/advanced/image.htm thirdparty/tinymce/themes/advanced/langs/en.js thirdparty/tinymce/themes/advanced/langs/en_dlg.js thirdparty/tinymce/themes/advanced/link.htm thirdparty/tinymce/themes/advanced/source_editor.htm thirdparty/tinymce/themes/simple/langs/en.js thirdparty/tinymce/tiny_mce.js thirdparty/tinymce/tiny_mce_src.js widgets/Widget.php
2011-02-14 06:47:53 +01:00
>>>>>>> 2.4
* Run coverage tests for one or more "modules".
* A module is generally a toplevel folder, e.g. "mysite" or "sapphire".
*/
function coverageModule($request) {
$this->module($request, true);
}
function cleanupdb() {
SapphireTest::delete_all_temp_dbs();
}
/**
* Run only a single test class or a comma-separated list of tests
*/
function only($request, $coverage = false) {
ManifestBuilder::load_test_manifest();
if($request->param('TestCase') == 'all') {
$this->all();
} else {
$classNames = explode(',', $request->param('TestCase'));
foreach($classNames as $className) {
if(!class_exists($className) || !is_subclass_of($className, 'SapphireTest')) {
user_error("TestRunner::only(): Invalid TestCase '$className', cannot find matching class", E_USER_ERROR);
}
}
$this->runTests($classNames, $coverage);
}
}
/**
* Run tests for one or more "modules".
* A module is generally a toplevel folder, e.g. "mysite" or "sapphire".
*/
function module($request, $coverage = false) {
ManifestBuilder::load_test_manifest();
$classNames = array();
$moduleNames = explode(',', $request->param('ModuleName'));
foreach($moduleNames as $moduleName) {
$classesForModule = ClassInfo::classes_for_folder($moduleName);
if($classesForModule) foreach($classesForModule as $class) {
if(class_exists($class) && is_subclass_of($class, 'SapphireTest')) {
$classNames[] = $class;
}
}
}
$this->runTests($classNames, $coverage);
}
/**
* @param array $classList
* @param boolean $coverage
*/
function runTests($classList, $coverage = false) {
$startTime = microtime(true);
// XDEBUG seem to cause problems with test execution :-(
if(function_exists('xdebug_disable')) xdebug_disable();
ini_set('max_execution_time', 0);
$this->setUp();
// Optionally skip certain tests
$skipTests = array();
if($this->request->getVar('SkipTests')) {
$skipTests = explode(',', $this->request->getVar('SkipTests'));
}
$classList = array_diff($classList, $skipTests);
// run tests before outputting anything to the client
$suite = new PHPUnit_Framework_TestSuite();
natcasesort($classList);
foreach($classList as $className) {
// Ensure that the autoloader pulls in the test class, as PHPUnit won't know how to do this.
class_exists($className);
$suite->addTest(new SapphireTestSuite($className));
}
// Remove the error handler so that PHPUnit can add its own
restore_error_handler();
self::$default_reporter->writeHeader("Sapphire Test Runner");
if (count($classList) > 1) {
self::$default_reporter->writeInfo("All Tests", "Running test cases: ",implode(", ", $classList));
} else
if (count($classList) == 1) {
self::$default_reporter->writeInfo($classList[0], "");
} else {
// border case: no tests are available.
self::$default_reporter->writeInfo("", "");
}
// perform unit tests (use PhpUnitWrapper or derived versions)
$phpunitwrapper = PhpUnitWrapper::inst();
$phpunitwrapper->setSuite($suite);
$phpunitwrapper->setCoverageStatus($coverage);
$phpunitwrapper->runTests();
// get results of the PhpUnitWrapper class
$reporter = $phpunitwrapper->getReporter();
$results = $phpunitwrapper->getFrameworkTestResults();
if(!Director::is_cli()) echo '<div class="trace">';
$reporter->writeResults();
$endTime = microtime(true);
if(Director::is_cli()) echo "\n\nTotal time: " . round($endTime-$startTime,3) . " seconds\n";
else echo "<p>Total time: " . round($endTime-$startTime,3) . " seconds</p>\n";
if(!Director::is_cli()) echo '</div>';
// Put the error handlers back
Debug::loadErrorHandlers();
if(!Director::is_cli()) self::$default_reporter->writeFooter();
$this->tearDown();
// Todo: we should figure out how to pass this data back through Director more cleanly
if(Director::is_cli() && ($results->failureCount() + $results->errorCount()) > 0) exit(2);
}
/**
* 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 (leave blank to start with default set-up): <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'];
if($fixtureFile) {
// Validate fixture file
$realFile = realpath(BASE_PATH.'/'.$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();
DB::set_alternative_database_name($dbname);
// Fixture
if($fixtureFile) {
$fixture = new YamlFixture($fixtureFile);
$fixture->saveIntoDatabase();
// If no fixture, then use defaults
} else {
$dataClasses = ClassInfo::subclassesFor('DataObject');
array_shift($dataClasses);
foreach($dataClasses as $dataClass) singleton($dataClass)->requireDefaultRecords();
}
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>
<li><a id=\"endsession-link\" href=\"" .Director::baseURL() . "dev/tests/endsession\">End your test session</a></li>
</ul>";
}
} else {
return "<p>startession can only be used on dev and test sites</p>";
}
}
function emptydb() {
if(SapphireTest::using_temp_db()) {
SapphireTest::empty_temp_db();
if(isset($_GET['fixture']) && ($fixtureFile = $_GET['fixture'])) {
$fixture = new YamlFixture($fixtureFile);
$fixture->saveIntoDatabase();
return "<p>Re-test the test database with fixture '$fixtureFile'. Time to start testing; where would you like to start?</p>";
} else {
return "<p>Re-test the test database. Time to start testing; where would you like to start?</p>";
}
} else {
return "<p>dev/tests/emptydb can only be used with a temporary database. Perhaps you should use dev/tests/startsession first?</p>";
}
}
function endsession() {
SapphireTest::kill_temp_db();
DB::set_alternative_database_name(null);
return "<p>Test session ended.</p>
<ul>
<li><a id=\"home-link\" href=\"" .Director::baseURL() . "\">Return to your site</a></li>
<li><a id=\"startsession-link\" href=\"" .Director::baseURL() . "dev/tests/startsession\">Start a new test session</a></li>
</ul>";
}
function sessionloadyml() {
// Load incremental YAML fixtures
// TODO: We will probably have to filter out the admin member here,
// as it is supplied by Bare.yml
if(Director::isLive()) {
return "<p>sessionloadyml can only be used on dev and test sites</p>";
}
if (!SapphireTest::using_temp_db()) {
return "<p>Please load /dev/tests/startsession first</p>";
}
$fixtureFile = isset($_GET['fixture']) ? $_GET['fixture'] : null;
if (empty($fixtureFile)) {
$me = Director::baseURL() . "/dev/tests/sessionloadyml";
return <<<HTML
<form action="$me">
<p>Enter a fixture file name to load a new YAML fixture into the session.</p>
<p>Fixture file <input id="fixture-file" name="fixture" /></p>
<input type="hidden" name="flush" value="1">
<p><input id="session-load-yaml" value="Load yml fixture" type="submit" /></p>
</form>
HTML;
}
// Validate fixture file
$realFile = realpath(BASE_PATH.'/'.$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>";
}
// Fixture
$fixture = new YamlFixture($fixtureFile);
$fixture->saveIntoDatabase();
return "<p>Loaded fixture '$fixtureFile' into session</p>";
}
function setUp() {
// The first DB test will sort out the DB, we don't have to
SSViewer::flush_template_cache();
}
function tearDown() {
SapphireTest::kill_temp_db();
DB::set_alternative_database_name(null);
}
}