Skip to content

Commit

Permalink
Update Travis configuration to new style, add phpcs configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Aug 23, 2017
1 parent a3c7c8b commit c96c8c3
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 45 deletions.
37 changes: 24 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
language: php

php:
- 5.6
- 7.0
- 7.1

env:
- DB=MYSQL CORE_RELEASE=4
global:
- COMPOSER_ROOT_VERSION=4.0.x-dev

matrix:
include:
- php: 5.6
env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
- php: 7.0
env: DB=MYSQL PHPUNIT_TEST=1
- php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1

before_script:
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss
# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

# Install composer dependencies
- composer install --prefer-dist
- composer require --prefer-dist --no-update silverstripe/framework:4.0.x-dev silverstripe/cms:4.0.x-dev silverstripe/admin:1.0.x-dev
- composer update

script:
- vendor/bin/phpunit --coverage-clover segment-field/coverage.clover segment-field/tests
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi

after_success:
- cd segment-field
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
3 changes: 0 additions & 3 deletions _config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
<?php

define('SEGMENT_FIELD_PATH', __DIR__);
define('SEGMENT_FIELD_DIR', basename(__DIR__));
Empty file added _config/config.yml
Empty file.
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"require-dev": {
"phpunit/phpunit": "^5.7",
"mockery/mockery": "^0.9",
"squizlabs/php_codesniffer": "^3",
"silverstripe/reports": "^4.0@dev",
"silverstripe/siteconfig": "^4.0@dev"
},
Expand All @@ -27,12 +28,10 @@
},
"autoload": {
"psr-4": {
"SilverStripe\\Forms\\": "code"
"SilverStripe\\Forms\\": "code/",
"SilverStripe\\Forms\\Tests\\": "tests/"
}
},
"autoload-dev": {
"psr-4": {
"SilverStripe\\Forms\\Tests\\": "tests"
}
}
"minimum-stability": "dev",
"prefer-stable": true
}
21 changes: 21 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<!-- base rules are PSR-2 -->
<rule ref="PSR2" >
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="Squiz.Scope.MethodScope" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
</rule>
</ruleset>
23 changes: 0 additions & 23 deletions phpunit.xml

This file was deleted.

13 changes: 13 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<phpunit bootstrap="cms/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit c96c8c3

Please sign in to comment.