mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Update for SilverStripe\ORM namespace
Lock master branch to 4.x compat due to incompatibliities
This commit is contained in:
parent
e66772fdce
commit
cbcd808dde
10
.travis.yml
10
.travis.yml
@ -4,7 +4,7 @@ language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
php:
|
||||
- 5.5
|
||||
|
||||
env:
|
||||
@ -15,12 +15,8 @@ matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: DB=PGSQL CORE_RELEASE=master
|
||||
- php: 5.5
|
||||
- php: 5.6
|
||||
env: DB=MYSQL CORE_RELEASE=master
|
||||
- php: 5.3
|
||||
env: DB=MYSQL CORE_RELEASE=3.2
|
||||
- php: 5.3
|
||||
env: DB=MYSQL CORE_RELEASE=3
|
||||
|
||||
before_script:
|
||||
- phpenv rehash
|
||||
@ -28,5 +24,5 @@ before_script:
|
||||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
|
||||
- cd ~/builds/ss
|
||||
|
||||
script:
|
||||
script:
|
||||
- phpunit testsession/tests/unit/
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DB;
|
||||
|
||||
// Determine whether there is a testsession currently running, and if so - setup the persistent details for it.
|
||||
Injector::inst()->get('TestSessionEnvironment')->loadFromFile();
|
||||
|
||||
|
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\ArrayList;
|
||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||
|
||||
/**
|
||||
* Requires PHP's mycrypt extension in order to set the database name as an encrypted cookie.
|
||||
*/
|
||||
@ -55,7 +60,7 @@ class TestSessionController extends Controller
|
||||
|
||||
public function Link($action = null)
|
||||
{
|
||||
return Controller::join_links(Director::baseUrl(), 'dev/testsession', $action);
|
||||
return Controller::join_links(Director::baseURL(), 'dev/testsession', $action);
|
||||
}
|
||||
|
||||
public function index()
|
||||
@ -104,11 +109,11 @@ class TestSessionController extends Controller
|
||||
// Optionally import database
|
||||
if (!empty($params['importDatabasePath']) || !empty($params['importDatabaseFilename'])) {
|
||||
$absPath = '';
|
||||
|
||||
|
||||
// by path
|
||||
if (!empty($params['importDatabasePath'])) {
|
||||
$absPath = $params['importDatabasePath'];
|
||||
|
||||
|
||||
// by filename
|
||||
} elseif (!empty($params['importDatabaseFilename'])) {
|
||||
foreach ($this->getDatabaseTemplates() as $tAbsPath => $tFilename) {
|
||||
@ -137,6 +142,8 @@ class TestSessionController extends Controller
|
||||
|
||||
/**
|
||||
* Set $_SESSION state for the current browser session.
|
||||
*
|
||||
* @param SS_HTTPRequest $request
|
||||
*/
|
||||
public function browsersessionstate($request)
|
||||
{
|
||||
@ -252,7 +259,7 @@ class TestSessionController extends Controller
|
||||
* Updates an in-progress {@link TestSessionEnvironment} object with new details. This could be loading in new
|
||||
* fixtures, setting the mocked date to another value etc.
|
||||
*
|
||||
* @return HTMLText Rendered Template
|
||||
* @return DBHTMLText Rendered Template
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function set()
|
||||
|
@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\DatabaseAdmin;
|
||||
use SilverStripe\ORM\Versioning\Versioned;
|
||||
|
||||
/**
|
||||
* Responsible for starting and finalizing test sessions.
|
||||
* Since these session span across multiple requests, session information is persisted
|
||||
|
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DataModel;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
use SilverStripe\ORM\DB;
|
||||
|
||||
/**
|
||||
* Sets state previously initialized through {@link TestSessionController}.
|
||||
*/
|
||||
@ -25,13 +30,13 @@ class TestSessionRequestFilter implements RequestFilter
|
||||
|
||||
// Date and time
|
||||
if (isset($testState->datetime)) {
|
||||
SS_Datetime::set_mock_now($testState->datetime);
|
||||
DBDatetime::set_mock_now($testState->datetime);
|
||||
}
|
||||
|
||||
// Register mailer
|
||||
if (isset($testState->mailer)) {
|
||||
$mailer = $testState->mailer;
|
||||
Email::set_mailer(new $mailer());
|
||||
Injector::inst()->registerService(new $mailer(), 'Mailer');
|
||||
Config::inst()->update("Email", "send_all_emails_to", null);
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,13 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"composer/installers": "*",
|
||||
"silverstripe/framework": ">=3.2.0"
|
||||
"silverstripe/framework": "^4"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user