silverstripe-framework/tests/model/DBTest.php
Ingo Schommer 3334eafcb1 API Marked statics private, use Config API instead (#8317)
See "Static configuration properties are now immutable, you must use Config API." in the 3.1 change log for details.
2013-03-24 17:20:53 +01:00

22 lines
785 B
PHP

<?php
/**
* @package framework
* @subpackage tests
*/
class DBTest extends SapphireTest {
function testValidAlternativeDatabaseName() {
Config::inst()->update('Director', 'environment_type', 'dev');
$this->assertTrue(DB::valid_alternative_database_name('ss_tmpdb1234567'));
$this->assertFalse(DB::valid_alternative_database_name('ss_tmpdb12345678'));
$this->assertFalse(DB::valid_alternative_database_name('tmpdb1234567'));
$this->assertFalse(DB::valid_alternative_database_name('random'));
$this->assertFalse(DB::valid_alternative_database_name(''));
Config::inst()->update('Director', 'environment_type', 'live');
$this->assertFalse(DB::valid_alternative_database_name('ss_tmpdb1234567'));
Config::inst()->update('Director', 'environment_type', 'dev');
}
}