Skip to content

Commit

Permalink
Merge pull request #17 from creative-commoners/pulls/master/phpunit9
Browse files Browse the repository at this point in the history
API Migrate to PHPUnit 9
  • Loading branch information
Maxime Rainville authored Oct 28, 2021
2 parents f4e9207 + cbd408d commit 30f89c6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 49 deletions.
34 changes: 3 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
language: php
version: ~> 1.0

services:
- mysql

env:
global:
- TRAVIS_NODE_VERSION="10"

matrix:
include:
- php: 7.2
env: DB=MYSQL SYMFONY_VERSION=^4 FRAMEWORK_VERSION=4.5.1 PHPUNIT_TEST=1
- php: 7.3
env: DB=MYSQL FRAMEWORK_VERSION=4.x-dev PHPUNIT_TEST=1 PHPCS_TEST=1

before_script:
- phpenv rehash
- phpenv config-rm xdebug.ini

- composer validate
- composer require --no-update silverstripe/framework:"$FRAMEWORK_VERSION"
- if [[ $SYMFONY_VERSION ]]; then composer require --no-update symfony/event-dispatcher:$SYMFONY_VERSION; fi
- composer install --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile

script:
- 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:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -F php; fi
import:
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-fixed.yml
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
],
"license": "BSD-3-Clause",
"require": {
"silverstripe/framework": "^4.5.1",
"silverstripe/framework": "^4.10",
"symfony/event-dispatcher": "^4.4 || ^5",
"psr/event-dispatcher": "^1",
"php": "^7.2"
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
Expand Down
10 changes: 6 additions & 4 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<!-- base rules are PSR-12 -->
<rule ref="PSR12" >
<file>src</file>
<file>tests</file>

<!-- base rules are PSR-2 -->
<rule ref="PSR2">
<!-- Current exclusions -->
<!--<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />-->
<!--<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />-->
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
</rule>
</ruleset>
25 changes: 14 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="silverstripe-module/skeleton">
<directory>tests/</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 30f89c6

Please sign in to comment.