-
-
Save kinglozzer/4ce2822df233c6ee18fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If we're requesting a different database for testing | |
if(isset($_REQUEST['db'])) { | |
if( | |
class_exists('PHPUnit_Runner_Version') // If the PHPUnit runner is loaded | |
|| php_sapi_name() === "cli" // Or we're definitely in CLI mode | |
|| (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/dev/tests') !== false) // Or we're running tests in-browser | |
) { | |
global $databaseConfig; | |
switch ($_REQUEST['db']) { | |
case 'sqlite': | |
case 'sqlite3': | |
define('SS_DATABASE_CLASS', 'SQLite3Database'); | |
define('SS_SQLITE_DATABASE_PATH', ':memory:'); | |
$databaseConfig["path"] = ':memory:'; | |
break; | |
default: | |
user_error('Unknown database type: ' . $_REQUEST['db'], E_USER_WARNING); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment