Skip to content

Commit bcad56d

Browse files
jdufresnejfritschi
authored andcommitted
Allow running tests from the top level directory (#327)
This makes it simpler for contributors to run tests, and it better follows community wide conventions. The test configuration now follows the PHPUnit recommendations at: https://phpunit.readthedocs.io/en/8.5/organizing-tests.html The PHPUnit XML configuration has been moved to the top level directory. Relative paths have been adjusted to account for the new location. The unnecessary "suffix" attributes have been removed, they just repeat defaults.
1 parent 451b2ae commit bcad56d

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ script:
1515
# Composer is testing-only; vendor folder should not appear in releases
1616
- if [[ $TRAVIS_PHP_VERSION == 'nightly' ]]; then composer --no-interaction config platform.php 7.4.0; fi
1717
- composer install
18-
- cd test && ../vendor/bin/phpunit --verbose --stderr
18+
- ./vendor/bin/phpunit --verbose --stderr
1919
matrix:
2020
fast_finish: true
2121
allow_failures:

test/phpunit.xml phpunit.xml.dist

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
3-
bootstrap="../source/CAS.php"
3+
bootstrap="source/CAS.php"
44
convertNoticesToExceptions="false"
55
colors="true"
66
stderr="true"
@@ -9,13 +9,13 @@
99

1010
<testsuites>
1111
<testsuite name="phpCAS Tests">
12-
<directory suffix="Test.php">CAS/Tests/</directory>
12+
<directory>test/CAS/Tests/</directory>
1313
</testsuite>
1414
</testsuites>
1515

1616
<filter>
1717
<whitelist addUncoveredFilesFromWhitelist="false">
18-
<directory suffix=".php">../source/</directory>
18+
<directory>source/</directory>
1919
</whitelist>
2020
</filter>
2121
</phpunit>

test/README.txt

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ These unit tests currently only cover a small portion of the operation of phpCAS
88
**************************
99
* Running tests
1010
**************************
11-
1. Install PHPUnit using instructions on this page:
12-
http://pear.phpunit.de/
11+
1. Install PHPUnit using composer:
12+
composer install
1313

14-
2. cd to the phpcas/test/ directory.
15-
16-
3. Run the following command:
17-
phpunit
14+
2. Run the following command:
15+
./vendor/bin/phpunit
1816

1917

2018

0 commit comments

Comments
 (0)