Merge pull request #15 from tractorcow/pulls/3.2-api

Update for framework 3.2 compatibility
This commit is contained in:
Damian Mooyman 2014-07-21 10:38:49 +12:00
commit 69d20eade1
5 changed files with 37 additions and 37 deletions

View File

@ -7,16 +7,16 @@ php:
env:
matrix:
- DB=MYSQL CORE_RELEASE=3.1
- DB=MYSQL CORE_RELEASE=master
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
env: DB=MYSQL CORE_RELEASE=master
- php: 5.5
env: DB=MYSQL CORE_RELEASE=3.1
env: DB=MYSQL CORE_RELEASE=master
before_script:
- phpenv rehash

View File

@ -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();
}
/**

View File

@ -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);
}
}
}

View File

@ -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

View File

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