Add phpunit/phpcs configuration and update Travis configuration

This commit is contained in:
Robbie Averill 2018-07-03 11:35:52 +12:00
parent fe5148e678
commit 8d295ada9c
4 changed files with 56 additions and 20 deletions

View File

@ -1,39 +1,47 @@
# See https://github.com/silverstripe/silverstripe-travis-support for setup details
language: php
sudo: false
addons:
apt:
packages:
- poppler-utils
env:
global:
- COMPOSER_ROOT_VERSION=3.x-dev
- SS_TIKA_ENDPOINT="http://localhost:9998/"
matrix:
include:
- php: 5.4
env: DB=PGSQL CORE_RELEASE=3.2
- php: 5.5
env: DB=PGSQL CORE_RELEASE=3.3
- php: 5.6
env: DB=PGSQL CORE_RELEASE=3.4
- php: 5.6
env: DB=MYSQL CORE_RELEASE=3.5
env: DB=MYSQL RECIPE_VERSION=1.0.x-dev PHPCS_TEST=1 PHPUNIT_TEST=1
- php: 7.0
env: DB=MYSQL CORE_RELEASE=3.6
env: DB=MYSQL RECIPE_VERSION=1.1.x-dev PHPUNIT_TEST=1
- php: 7.1
env: DB=MYSQL CORE_RELEASE=3
env: DB=PGSQL RECIPE_VERSION=4.2.x-dev PHPUNIT_COVERAGE_TEST=1
- php: 7.2
env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1
before_script:
- composer self-update || true
# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini
# Configure Tika bin
- mkdir -p $HOME/bin
- export PATH=$PATH:$HOME/bin
- export SS_TIKA_ENDPOINT="http://localhost:9998/"
- ./.travis/install_tika.sh
- 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
- composer install
- ($HOME/bin/tika-rest-server &) &> /dev/null
# Install composer dependencies
- composer validate
- composer require --no-update silverstripe/recipe-core "$RECIPE_VERSION"
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql 2.1.x-dev; fi
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
script:
- ($HOME/bin/tika-rest-server &) &> /dev/null
- vendor/bin/phpunit --verbose textextraction/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:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi

3
codecov.yml Normal file
View File

@ -0,0 +1,3 @@
comment: false
codecov:
branch: master

11
phpcs.xml.dist Normal file
View File

@ -0,0 +1,11 @@
<?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" />-->
</rule>
</ruleset>

14
phpunit.xml.dist Normal file
View File

@ -0,0 +1,14 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/php</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>