diff --git a/.editorconfig b/.editorconfig
index 47ae637..7d56e29 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -10,7 +10,7 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
-[{*.yml,package.json}]
+[{*.yml,*.json}]
indent_size = 2
# The indent size used in the package.json file cannot be changed:
diff --git a/.travis.yml b/.travis.yml
index 84d2a6b..a6d3823 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,28 +1,34 @@
-# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
-
language: php
sudo: false
-php:
- - 5.5
-
env:
- matrix:
- - DB=MYSQL CORE_RELEASE=master
+ global:
+ - COMPOSER_ROOT_VERSION=2.0.x-dev
+ - CORE_RELEASE=master
matrix:
include:
- php: 5.6
- env: DB=PGSQL CORE_RELEASE=master
+ env:
+ - PHPUNIT_TEST=1
+ - DB=PGSQL
- php: 5.6
- env: DB=MYSQL CORE_RELEASE=master
+ env:
+ - PHPUNIT_TEST=1
+ - DB=MYSQL
+ - php: 5.6
+ env:
+ - PHPCS_TEST=1
+ - DB=MYSQL
before_script:
+ - if [[ $PHPCS_TEST ]]; then pyrus install pear/PHP_CodeSniffer; fi
- phpenv rehash
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss
script:
- - vendor/bin/phpunit testsession/tests/unit/
+ - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit testsession/tests/; fi
+ - if [[ $PHPCS_TEST ]]; then (cd testsession && composer run-script lint); fi
diff --git a/.upgrade.yml b/.upgrade.yml
new file mode 100644
index 0000000..91af6bd
--- /dev/null
+++ b/.upgrade.yml
@@ -0,0 +1,6 @@
+mappings:
+ TestSessionController: SilverStripe\TestSession\TestSessionController
+ TestSessionEnvironment: SilverStripe\TestSession\TestSessionEnvironment
+ TestSessionRequestFilter: SilverStripe\TestSession\TestSessionRequestFilter
+ TestSessionStubCodeWriter: SilverStripe\TestSession\TestSessionStubCodeWriter
+ TestSessionStubCodeWriterTest: SilverStripe\TestSession\Tests\TestSessionStubCodeWriterTest
diff --git a/_config.php b/_config.php
index 237dd1a..7bd9a34 100644
--- a/_config.php
+++ b/_config.php
@@ -1,11 +1,10 @@
get('TestSessionEnvironment')->loadFromFile();
+TestSessionEnvironment::singleton()->loadFromFile();
/**
* This closure will run every time a Resque_Event is forked (just before it is forked, so it applies to the parent
@@ -20,7 +19,7 @@ if(class_exists('Resque_Event') && class_exists('SSResqueRun')) {
// calling {@link TestSessionEnvironment::loadFromFile()}.
DB::connect($databaseConfig);
- $testEnv = Injector::inst()->get('TestSessionEnvironment');
+ $testEnv = TestSessionEnvironment::singleton();
if($testEnv->isRunningTests()) {
$testEnv->loadFromFile();
diff --git a/_config/_config.yml b/_config/_config.yml
deleted file mode 100644
index b3afead..0000000
--- a/_config/_config.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-Name: testsessionprocessors
----
-SilverStripe\Core\Injector\Injector:
- RequestProcessor:
- properties:
- filters:
- - '%$TestSessionRequestFilter'
diff --git a/_config/processors.yml b/_config/processors.yml
new file mode 100644
index 0000000..d52ef3c
--- /dev/null
+++ b/_config/processors.yml
@@ -0,0 +1,8 @@
+---
+Name: testsessionprocessors
+---
+SilverStripe\Core\Injector\Injector:
+ SilverStripe\Control\RequestProcessor:
+ properties:
+ filters:
+ - '%$SilverStripe\TestSession\TestSessionRequestFilter'
diff --git a/_config/services.yml b/_config/services.yml
new file mode 100644
index 0000000..69c915f
--- /dev/null
+++ b/_config/services.yml
@@ -0,0 +1,8 @@
+---
+Name: testsessionservices
+---
+SilverStripe\Core\Injector\Injector:
+ SilverStripe\TestSession\TestSessionEnvironment:
+ class: SilverStripe\TestSession\TestSessionEnvironment
+ # shorthand alias for FQN
+ TestSessionEnvironment: %$SilverStripe\TestSession\TestSessionEnvironment
diff --git a/javascript/testsession.js b/client/js/testsession.js
similarity index 100%
rename from javascript/testsession.js
rename to client/js/testsession.js
diff --git a/css/styles.css b/client/styles/styles.css
similarity index 100%
rename from css/styles.css
rename to client/styles/styles.css
diff --git a/composer.json b/composer.json
index 1528c21..9627fb2 100644
--- a/composer.json
+++ b/composer.json
@@ -1,24 +1,36 @@
{
- "name": "silverstripe/testsession",
- "type": "silverstripe-module",
- "description": "Support module for browser-based test sessions, e.g. for Behat behaviour testing",
- "homepage": "http://silverstripe.org",
- "license": "BSD-3-Clause",
- "keywords": ["silverstripe", "testing"],
- "authors": [
- {
- "name": "SilverStripe",
- "homepage": "http://silverstripe.com"
- }
- ],
- "require": {
- "composer/installers": "*",
- "silverstripe/framework": "^4@dev"
- },
- "extra": {
- "branch-alias": {
- "dev-master": "2.0.x-dev"
- }
- },
- "minimum-stability": "dev"
+ "name": "silverstripe/testsession",
+ "type": "silverstripe-module",
+ "description": "Support module for browser-based test sessions, e.g. for Behat behaviour testing",
+ "homepage": "http://silverstripe.org",
+ "license": "BSD-3-Clause",
+ "keywords": [
+ "silverstripe",
+ "testing"
+ ],
+ "authors": [
+ {
+ "name": "SilverStripe",
+ "homepage": "http://silverstripe.com"
+ }
+ ],
+ "require": {
+ "composer/installers": "*",
+ "silverstripe/framework": "^4@dev"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.x-dev"
+ }
+ },
+ "scripts": {
+ "lint": "phpcs -s src/ tests/"
+ },
+ "autoload": {
+ "psr-4": {
+ "SilverStripe\\TestSession\\": "src/",
+ "SilverStripe\\TestSession\\Tests\\": "tests/"
+ }
+ },
+ "minimum-stability": "dev"
}
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
new file mode 100644
index 0000000..5a8fb14
--- /dev/null
+++ b/phpcs.xml.dist
@@ -0,0 +1,10 @@
+
+