diff --git a/.travis.yml b/.travis.yml
index bac7f1100..d1184faba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,10 +13,39 @@ matrix:
sudo: false
+if: type = pull_request OR (type = push AND (branch = develop OR branch = master))
+
+cache:
+ directories:
+ - $HOME/.composer/cache/files
+
install:
- - composer self-update
- - travis_retry composer install --no-interaction --prefer-source
+ - travis_retry composer install --no-interaction --no-progress --no-suggest
before_script: git reset --hard HEAD
-script: vendor/bin/phpunit
+stages:
+ - test
+ - code quality
+ - code coverage
+
+script:
+ - ./vendor/bin/parallel-lint --exclude vendor --exclude storage --exclude tests/fixtures/plugins/testvendor/goto/Plugin.php .
+ - ./vendor/bin/phpunit
+
+jobs:
+ include:
+ - stage: code coverage
+ if: type = push AND (branch = develop OR branch = master)
+ php: 7.1
+ script:
+ - ./vendor/bin/phpunit --testsuite "October CMS Test Suite" --coverage-clover=coverage.xml
+ - bash <(curl -s https://codecov.io/bash)
+ - stage: code quality
+ if: type = pull_request
+ php: 7.1
+ script: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff-tree --no-commit-id --name-only -r ${TRAVIS_COMMIT_RANGE/.../..})
+ - stage: code quality
+ if: type = push AND (branch = develop OR branch = master)
+ php: 7.1
+ script: ./vendor/bin/phpcs --colors -nq --report="full" --extensions="php" $(git diff-tree --no-commit-id --name-only -r $TRAVIS_COMMIT)
diff --git a/composer.json b/composer.json
index 39af52963..dc03babb0 100644
--- a/composer.json
+++ b/composer.json
@@ -42,9 +42,11 @@
},
"require-dev": {
"fzaninotto/faker": "~1.7",
- "phpunit/phpunit": "~5.7",
+ "phpunit/phpunit": "~6.5",
"phpunit/phpunit-selenium": "~1.2",
- "meyfa/phpunit-assert-gd": "1.1.0"
+ "meyfa/phpunit-assert-gd": "1.1.0",
+ "squizlabs/php_codesniffer": "3.*",
+ "jakub-onderka/php-parallel-lint": "^1.0"
},
"autoload-dev": {
"classmap": [
diff --git a/modules/backend/controllers/Index.php b/modules/backend/controllers/Index.php
index 28f7289c1..75a18eb3a 100644
--- a/modules/backend/controllers/Index.php
+++ b/modules/backend/controllers/Index.php
@@ -71,7 +71,9 @@ class Index extends Controller
protected function checkPermissionRedirect()
{
if (!$this->user->hasAccess('backend.access_dashboard')) {
- $true = function () { return true; };
+ $true = function () {
+ return true;
+ };
if ($first = array_first(BackendMenu::listMainMenuItems(), $true)) {
return Redirect::intended($first->url);
}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000000000..3ffeebc67
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,16 @@
+
+
+ The coding standard for October CMS.
+
+
+
+
+ bootstrap/
+ config/
+ modules/
+ tests
+
+ vendor/
+ storage/
+ plugins/
+
diff --git a/phpunit.xml b/phpunit.xml
index d75f4e0df..08cd19d58 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -18,9 +18,26 @@
./vendor/october/rain/tests
+
+
+
+ ./modules/
+
+
+ ./modules/backend/routes.php
+ ./modules/cms/routes.php
+ ./modules/system/routes.php
+
+ ./modules/backend/database
+ ./modules/cms/database
+ ./modules/system/database
+
+
+
+
-
\ No newline at end of file
+