silverstripe-framework/tasks/CleanupTestDatabasesTask.php
Ingo Schommer d1af214ef5 API Removed custom dev/tests/ execution
Rely on standard vendor/bin/phpunit via CLI instead.
See https://github.com/silverstripe/silverstripe-framework/issues/4254

- Not disabling xdebug. That should be harmful, and is actively harming test development
- No longer able to specifically skip tests via the `SkipTests` request parameter. Use phpunit.xml groups and the `--exclude-group` CLI argument instead
- No longer able to specify multiple comma-separated module folders. use phpunit.xml groups and the `--group` CLI argument instead
- Not explicitly calling `SSViewer::flush_template_cache()` (was never the case on running `phpunit` CLI anyway, and shouldn't be required any more)
2016-02-23 20:19:35 +13:00

26 lines
679 B
PHP

<?php
/**
* Cleans up leftover databases from aborted test executions (starting with ss_tmpdb)
* Task is restricted to users with administrator rights or running through CLI.
*
* @package framework
* @subpackage tasks
*/
class CleanuPTestDatabasesTask extends BuildTask {
protected $title = 'Deletes all temporary test databases';
protected $description = 'Cleans up leftover databases from aborted test executions (starting with ss_tmpdb)';
public function init() {
parent::init();
if(!Permission::check('ADMIN') && !Director::is_cli()) {
return Security::permissionFailure($this);
}
}
public function run() {
SapphireTest::delete_all_temp_dbs();
}
}