Update for framework 3.2 compatibility

This commit is contained in:
Damian Mooyman 2014-07-21 10:10:54 +12:00
parent b98bbbe276
commit 869b4e8933
5 changed files with 34 additions and 34 deletions

View File

@ -12,7 +12,7 @@ env:
matrix: matrix:
include: include:
- php: 5.3 - php: 5.3
env: DB=PGSQL CORE_RELEASE=3.1 env: DB=PGSQL CORE_RELEASE=master
- php: 5.4 - php: 5.4
env: DB=MYSQL CORE_RELEASE=3.1 env: DB=MYSQL CORE_RELEASE=3.1
- php: 5.5 - php: 5.5

View File

@ -216,8 +216,8 @@ class TestSessionController extends Controller {
} }
public function DatabaseName() { public function DatabaseName() {
$db = DB::getConn(); $db = DB::get_conn();
if(method_exists($db, 'currentDatabase')) return $db->currentDatabase(); return $db->getSelectedDatabase();
} }
/** /**

View File

@ -174,7 +174,7 @@ class TestSessionEnvironment extends Object {
// ensure we have a connection to the database // ensure we have a connection to the database
if(isset($state->database) && $state->database) { if(isset($state->database) && $state->database) {
if(!DB::getConn()) { if(!DB::get_conn()) {
// No connection, so try and connect to tmpdb if it exists // No connection, so try and connect to tmpdb if it exists
if(isset($state->database)) { if(isset($state->database)) {
$this->oldDatabaseName = $databaseConfig['database']; $this->oldDatabaseName = $databaseConfig['database'];
@ -185,7 +185,7 @@ class TestSessionEnvironment extends Object {
DB::connect($databaseConfig); DB::connect($databaseConfig);
} else { } else {
// We've already connected to the database, do a fast check to see what database we're currently using // We've already connected to the database, do a fast check to see what database we're currently using
$db = DB::getConn()->currentDatabase(); $db = DB::get_conn()->getSelectedDatabase();
if(isset($state->database) && $db != $state->database) { if(isset($state->database) && $db != $state->database) {
$this->oldDatabaseName = $databaseConfig['database']; $this->oldDatabaseName = $databaseConfig['database'];
$databaseConfig['database'] = $state->database; $databaseConfig['database'] = $state->database;
@ -199,7 +199,7 @@ class TestSessionEnvironment extends Object {
$dbName = (isset($state->database)) ? $state->database : null; $dbName = (isset($state->database)) ? $state->database : null;
if($dbName) { if($dbName) {
$dbExists = DB::getConn()->databaseExists($dbName); $dbExists = DB::get_conn()->databaseExists($dbName);
} else { } else {
$dbExists = false; $dbExists = false;
} }
@ -393,10 +393,10 @@ class TestSessionEnvironment extends Object {
$databaseConfig['database'] = $this->oldDatabaseName; $databaseConfig['database'] = $this->oldDatabaseName;
$conn = DB::getConn(); $conn = DB::get_conn();
if($conn) { if($conn) {
$conn->selectDatabase($this->oldDatabaseName); $conn->selectDatabase($this->oldDatabaseName, false, false);
} }
} }
} }

View File

@ -2,7 +2,7 @@
/** /**
* Sets state previously initialized through {@link TestSessionController}. * Sets state previously initialized through {@link TestSessionController}.
*/ */
class TestSessionRequestFilter { class TestSessionRequestFilter implements RequestFilter {
/** /**
* @var TestSessionEnvironment * @var TestSessionEnvironment
@ -13,7 +13,7 @@ class TestSessionRequestFilter {
$this->testSessionEnvironment = Injector::inst()->get('TestSessionEnvironment'); $this->testSessionEnvironment = Injector::inst()->get('TestSessionEnvironment');
} }
public function preRequest($req, $session, $model) { public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model) {
if(!$this->testSessionEnvironment->isRunningTests()) return; if(!$this->testSessionEnvironment->isRunningTests()) return;
$testState = $this->testSessionEnvironment->getState(); $testState = $this->testSessionEnvironment->getState();
@ -46,7 +46,7 @@ class TestSessionRequestFilter {
} }
} }
public function postRequest() { public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model) {
if(!$this->testSessionEnvironment->isRunningTests()) return; if(!$this->testSessionEnvironment->isRunningTests()) return;
// Store PHP session // Store PHP session

View File

@ -14,7 +14,7 @@
"require": { "require": {
"php": ">=5.3.2", "php": ">=5.3.2",
"composer/installers": "*", "composer/installers": "*",
"silverstripe/framework": ">=3.1,<3.2" "silverstripe/framework": "~3.2"
}, },
"minimum-stability": "dev" "minimum-stability": "dev"
} }