Skip to content

Commit

Permalink
Enable code coverage report using coveralls.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Apr 17, 2015
1 parent d58cfbb commit e36bf98
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .travis.yml
Expand Up @@ -19,33 +19,52 @@ services:

matrix:
fast_finish: true

include:
- php: 5.4
env: COVERALLS=1

- php: 5.4
env: PHPCS=1

- php: hhvm-nightly
env: HHVM=1 DB=sqlite db_dsn='sqlite:///:memory:'

- php: hhvm-nightly
env: HHVM=1 DB=mysql db_dsn='mysql://travis@0.0.0.0/cakephp_test'

allow_failures:
- php: 7.0

- php: hhvm-nightly

before_script:
- composer self-update
- composer install --prefer-dist --no-interaction

- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi"

- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi"

- sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev satooshi/php-coveralls:dev-master; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"

- sh -c "if [ '$HHVM' != '1' ]; then echo 'extension = memcached.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"

- phpenv rehash
- set +H

script:
- sh -c "if [ '$PHPCS' != '1' ]; then phpunit; fi"
- sh -c "if [ '$PHPCS' != '1' & '$COVERALLS' != '1' ]; then phpunit; fi"

- sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi"

- sh -c "if [ '$COVERALLS' = '1' ]; then phpunit --coverage-clover build/logs/clover.xml; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/coveralls -c .coveralls.yml -v; fi"

notifications:
email: false
15 changes: 15 additions & 0 deletions phpunit.xml.dist
Expand Up @@ -23,13 +23,28 @@
<file>./tests/TestCase/DatabaseSuite.php</file>
</testsuite>
</testsuites>

<listeners>
<listener class="\Cake\TestSuite\Fixture\FixtureInjector" file="./src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>

<!-- Prevent coverage reports from looking in tests, vendors, config folders -->
<filter>
<blacklist>
<directory suffix=".php">./vendor/</directory>
<directory suffix=".ctp">./vendor/</directory>

<directory suffix=".php">./tests/</directory>
<directory suffix=".ctp">./tests/</directory>

<directory suffix=".php">./config/</directory>
</blacklist>
</filter>

<php>
<!-- SQLite
<env name="db_dsn" value="sqlite:///:memory:"/>
Expand Down

0 comments on commit e36bf98

Please sign in to comment.