mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Update for framework 3.2 compatibility
This commit is contained in:
parent
b98bbbe276
commit
869b4e8933
@ -12,7 +12,7 @@ env:
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.3
|
||||
env: DB=PGSQL CORE_RELEASE=3.1
|
||||
env: DB=PGSQL CORE_RELEASE=master
|
||||
- php: 5.4
|
||||
env: DB=MYSQL CORE_RELEASE=3.1
|
||||
- php: 5.5
|
||||
|
@ -216,8 +216,8 @@ class TestSessionController extends Controller {
|
||||
}
|
||||
|
||||
public function DatabaseName() {
|
||||
$db = DB::getConn();
|
||||
if(method_exists($db, 'currentDatabase')) return $db->currentDatabase();
|
||||
$db = DB::get_conn();
|
||||
return $db->getSelectedDatabase();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@ class TestSessionEnvironment extends Object {
|
||||
|
||||
// ensure we have a connection to the 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
|
||||
if(isset($state->database)) {
|
||||
$this->oldDatabaseName = $databaseConfig['database'];
|
||||
@ -185,7 +185,7 @@ class TestSessionEnvironment extends Object {
|
||||
DB::connect($databaseConfig);
|
||||
} else {
|
||||
// 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) {
|
||||
$this->oldDatabaseName = $databaseConfig['database'];
|
||||
$databaseConfig['database'] = $state->database;
|
||||
@ -199,7 +199,7 @@ class TestSessionEnvironment extends Object {
|
||||
$dbName = (isset($state->database)) ? $state->database : null;
|
||||
|
||||
if($dbName) {
|
||||
$dbExists = DB::getConn()->databaseExists($dbName);
|
||||
$dbExists = DB::get_conn()->databaseExists($dbName);
|
||||
} else {
|
||||
$dbExists = false;
|
||||
}
|
||||
@ -393,10 +393,10 @@ class TestSessionEnvironment extends Object {
|
||||
|
||||
$databaseConfig['database'] = $this->oldDatabaseName;
|
||||
|
||||
$conn = DB::getConn();
|
||||
$conn = DB::get_conn();
|
||||
|
||||
if($conn) {
|
||||
$conn->selectDatabase($this->oldDatabaseName);
|
||||
$conn->selectDatabase($this->oldDatabaseName, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Sets state previously initialized through {@link TestSessionController}.
|
||||
*/
|
||||
class TestSessionRequestFilter {
|
||||
class TestSessionRequestFilter implements RequestFilter {
|
||||
|
||||
/**
|
||||
* @var TestSessionEnvironment
|
||||
@ -13,7 +13,7 @@ class TestSessionRequestFilter {
|
||||
$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;
|
||||
|
||||
$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;
|
||||
|
||||
// Store PHP session
|
||||
|
@ -14,7 +14,7 @@
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"composer/installers": "*",
|
||||
"silverstripe/framework": ">=3.1,<3.2"
|
||||
"silverstripe/framework": "~3.2"
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user