Merge pull request #36 from open-sausages/pulls/namespace-orm

Update for SilverStripe\ORM namespace
This commit is contained in:
Ingo Schommer 2016-07-01 15:08:17 +12:00 committed by GitHub
commit 3b06f5f738
6 changed files with 33 additions and 15 deletions

View File

@ -4,7 +4,7 @@ language: php
sudo: false sudo: false
php: php:
- 5.5 - 5.5
env: env:
@ -15,12 +15,8 @@ matrix:
include: include:
- php: 5.6 - php: 5.6
env: DB=PGSQL CORE_RELEASE=master env: DB=PGSQL CORE_RELEASE=master
- php: 5.5 - php: 5.6
env: DB=MYSQL CORE_RELEASE=master 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: before_script:
- phpenv rehash - phpenv rehash
@ -28,5 +24,5 @@ before_script:
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss - cd ~/builds/ss
script: script:
- phpunit testsession/tests/unit/ - phpunit testsession/tests/unit/

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\ORM\DB;
// Determine whether there is a testsession currently running, and if so - setup the persistent details for it. // Determine whether there is a testsession currently running, and if so - setup the persistent details for it.
Injector::inst()->get('TestSessionEnvironment')->loadFromFile(); Injector::inst()->get('TestSessionEnvironment')->loadFromFile();

View File

@ -1,4 +1,9 @@
<?php <?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. * 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) 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() public function index()
@ -104,11 +109,11 @@ class TestSessionController extends Controller
// Optionally import database // Optionally import database
if (!empty($params['importDatabasePath']) || !empty($params['importDatabaseFilename'])) { if (!empty($params['importDatabasePath']) || !empty($params['importDatabaseFilename'])) {
$absPath = ''; $absPath = '';
// by path // by path
if (!empty($params['importDatabasePath'])) { if (!empty($params['importDatabasePath'])) {
$absPath = $params['importDatabasePath']; $absPath = $params['importDatabasePath'];
// by filename // by filename
} elseif (!empty($params['importDatabaseFilename'])) { } elseif (!empty($params['importDatabaseFilename'])) {
foreach ($this->getDatabaseTemplates() as $tAbsPath => $tFilename) { foreach ($this->getDatabaseTemplates() as $tAbsPath => $tFilename) {
@ -137,6 +142,8 @@ class TestSessionController extends Controller
/** /**
* Set $_SESSION state for the current browser session. * Set $_SESSION state for the current browser session.
*
* @param SS_HTTPRequest $request
*/ */
public function browsersessionstate($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 * 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. * fixtures, setting the mocked date to another value etc.
* *
* @return HTMLText Rendered Template * @return DBHTMLText Rendered Template
* @throws LogicException * @throws LogicException
*/ */
public function set() public function set()

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\ORM\DB;
use SilverStripe\ORM\DatabaseAdmin;
use SilverStripe\ORM\Versioning\Versioned;
/** /**
* Responsible for starting and finalizing test sessions. * Responsible for starting and finalizing test sessions.
* Since these session span across multiple requests, session information is persisted * Since these session span across multiple requests, session information is persisted

View File

@ -1,4 +1,9 @@
<?php <?php
use SilverStripe\ORM\DataModel;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\DB;
/** /**
* Sets state previously initialized through {@link TestSessionController}. * Sets state previously initialized through {@link TestSessionController}.
*/ */
@ -25,13 +30,13 @@ class TestSessionRequestFilter implements RequestFilter
// Date and time // Date and time
if (isset($testState->datetime)) { if (isset($testState->datetime)) {
SS_Datetime::set_mock_now($testState->datetime); DBDatetime::set_mock_now($testState->datetime);
} }
// Register mailer // Register mailer
if (isset($testState->mailer)) { if (isset($testState->mailer)) {
$mailer = $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); Config::inst()->update("Email", "send_all_emails_to", null);
} }

View File

@ -12,9 +12,13 @@
} }
], ],
"require": { "require": {
"php": ">=5.3.2",
"composer/installers": "*", "composer/installers": "*",
"silverstripe/framework": ">=3.2.0" "silverstripe/framework": "^4"
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
}, },
"minimum-stability": "dev" "minimum-stability": "dev"
} }