Skip to content

Commit b7e9cd6

Browse files
committed
cleanup test execution
- use phpunit installed from composer - lowercase tests/Bootstrap.php -> tests/bootstrap.php - moved phpunit --strict option to phpunix.xml - run coveralls without directly from .travis.yml - run tests with PHP 5.3.3 using travis-ci (requires --prefer-source) - added "composer self-update" to "before_script"
1 parent eacbc47 commit b7e9cd6

File tree

5 files changed

+40
-39
lines changed

5 files changed

+40
-39
lines changed

.travis.coveralls.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

.travis.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
language: php
22

33
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
4+
- 5.3.3
5+
- 5.3
6+
- 5.4
7+
- 5.5
78

8-
script:
9-
- phpunit --strict --verbose --coverage-clover build/logs/clover.xml
9+
before_script:
10+
# On PHP 5.3.3 we require "--prefer-source" option because of missing openssl issue
11+
- if [ "$TRAVIS_PHP_VERSION" = "5.3.3" ]; then prefer_source="--prefer-source"; else prefer_source=""; fi
12+
- composer self-update -n
13+
- composer install --dev -n $prefer_source
1014

11-
after_script:
12-
- ./.travis.coveralls.sh
15+
script:
16+
- php vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml
17+
- composer require --dev $prefer_source "satooshi/php-coveralls dev-master"
18+
- php vendor/bin/coveralls -n -v
1319

1420
notifications:
1521
email: false

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?xml version="1.0"?>
22
<phpunit
3-
bootstrap="./tests/Bootstrap.php"
3+
bootstrap="./tests/bootstrap.php"
44
convertErrorsToExceptions="true"
55
convertNoticesToExceptions="true"
66
convertWarningsToExceptions="true"
77
stopOnFailure="false"
88
processIsolation="false"
99
backupGlobals="false"
1010
syntaxCheck="true"
11+
strict="true"
1112
>
1213
<testsuite name="php-enum Test-Suite">
1314
<directory>./tests/MabeEnumTest</directory>

tests/Bootstrap.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/bootstrap.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
ini_set('error_reporting', E_ALL);
4+
5+
// installed itself
6+
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
7+
require_once __DIR__ . '/../vendor/autoload.php';
8+
9+
// installed as dependency
10+
} elseif (file_exists(__DIR__ . '/../../../autoload.php')) {
11+
require_once __DIR__ . '/../../../autoload.php';
12+
13+
// not installed
14+
} else {
15+
echo "php-enum not installed - please run 'composer install'" . PHP_EOL;
16+
exit;
17+
}
18+
19+
// autload test files
20+
spl_autoload_register(function ($className) {
21+
$file = __DIR__ . '/' . str_replace('\\', '/', $className) . '.php';
22+
if (file_exists($file)) {
23+
require $file;
24+
}
25+
});

0 commit comments

Comments
 (0)