Skip to content

Commit

Permalink
Merge pull request #6 from alexz707/Travis-Fix
Browse files Browse the repository at this point in the history
Fixing tests, added gitattributes
  • Loading branch information
matwright authored Dec 1, 2020
2 parents ce32f1b + c90ffd5 commit 1415342
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 23 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.coveralls.yml export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.scrutinizer.yml export-ignore
/.php_cs export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
66 changes: 51 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,65 @@
language: php

php:
- 7.3
- 7.4
cache:
directories:
- $HOME/.composer/cache

before_script:
- composer self-update
- composer install --dev --prefer-source;
env:
global:
- COMPOSER_ARGS="--no-interaction"

services:
- mysql

matrix:
fast_finish: true
allow_failures:
- php: nightly
include:
- php: 7.3
env:
- DEPS=lowest
- php: 7.3
env:
- DEPS=latest
- CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.4
env:
- DEPS=lowest
- php: 7.4
env:
- DEPS=latest
- php: nightly
env:
- DEPS=lowest
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
- php: nightly
env:
- DEPS=latest
- COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi

install:
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $LEGACY_DEPS != '' ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
- stty cols 120 && composer show
- wget https://scrutinizer-ci.com/ocular.phar

before_script:
- mysql -e "create database IF NOT EXISTS lmc_user;" -uroot

script:
- ./vendor/bin/phpunit --bootstrap=tests/bootstrap.php --configuration tests/phpunit.xml
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- ./vendor/bin/phpcs -n --standard=PSR2 ./src/ ./tests/

services:
- mysql

after_script:
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

notifications:
email: "[email protected]"



matrix:
fast_finish: true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LmcUser
=======
[![Build Status](https://travis-ci.com/LM-Commons/LmcUser.svg?branch=master)](https://travis-ci.com/LM-Commons/LmcUser.svg?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/LM-Commons/LmcUser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/LM-Commons/LmcUser/badges/quality-score.png?b=master)
[![Build Status](https://travis-ci.com/LM-Commons/LmcUser.svg?branch=master)](https://travis-ci.com/LM-Commons/LmcUser)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LM-Commons/LmcUser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/LM-Commons/LmcUser/?branch=master)
[![Gitter](https://badges.gitter.im/LM-Commons/community.svg)](https://gitter.im/LM-Commons/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Based on ZfcUser by Evan Coury and the ZF-Commons team
Expand Down
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,15 @@
"psr-0": {
"LmcUserTest": "tests/"
}
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}
13 changes: 7 additions & 6 deletions tests/phpunit.xml → phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<phpunit bootstrap="./bootstrap.php"
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand All @@ -9,29 +10,29 @@
backupGlobals="false"
>
<testsuite name="LmcUser Test Suite">
<directory>./LmcUserTest</directory>
<directory>./tests/LmcUserTest</directory>
</testsuite>

<php>
<const name="DB_MYSQL_DSN" value="mysql:host=localhost;dbname=lmc_user" />
<const name="DB_MYSQL_USERNAME" value="root" />
<const name="DB_MYSQL_PASSWORD" value="" />
<const name="DB_MYSQL_SCHEMA" value="../data/schema.mysql.sql" />
<const name="DB_MYSQL_SCHEMA" value="./data/schema.mysql.sql" />

<const name="DB_SQLITE_DSN" value="sqlite::memory:" />
<const name="DB_SQLITE_USERNAME" value="" />
<const name="DB_SQLITE_PASSWORD" value="" />
<const name="DB_SQLITE_SCHEMA" value="../data/schema.sqlite.sql" />
<const name="DB_SQLITE_SCHEMA" value="./data/schema.sqlite.sql" />
</php>

<filter>
<whitelist>
<directory suffix=".php">../src</directory>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-text" target="php://stdout"/>
<log type="coverage-clover" target="../build/logs/clover.xml"/>
<log type="coverage-clover" target="./build/logs/clover.xml"/>
</logging>
</phpunit>

0 comments on commit 1415342

Please sign in to comment.