2012-12-06 16:25:45 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package framework
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class DBTest extends SapphireTest {
|
|
|
|
|
|
|
|
function testValidAlternativeDatabaseName() {
|
2013-03-21 19:48:54 +01:00
|
|
|
Config::inst()->update('Director', 'environment_type', 'dev');
|
2012-12-06 16:25:45 +01:00
|
|
|
$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(''));
|
|
|
|
|
2013-03-21 19:48:54 +01:00
|
|
|
Config::inst()->update('Director', 'environment_type', 'live');
|
2012-12-06 16:25:45 +01:00
|
|
|
$this->assertFalse(DB::valid_alternative_database_name('ss_tmpdb1234567'));
|
2013-03-21 19:48:54 +01:00
|
|
|
|
|
|
|
Config::inst()->update('Director', 'environment_type', 'dev');
|
2012-12-06 16:25:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|