File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 5454 - name : Install latest dependencies
5555 run : composer update ${{ env.COMPOSER_FLAGS }}
5656
57+ # Provides flexibilty for using either simple-phpunit or phpunit
58+ - name : Determine PHPUnit binary
59+ run : |
60+ name=$([ -f vendor/bin/simple-phpunit ] && echo simple-phpunit || echo phpunit)
61+ echo "BIN_PHPUNIT=vendor/bin/$name" >> $GITHUB_ENV
62+ shell : bash
63+
5764 - name : Run tests
58- run : vendor/bin/simple-phpunit --verbose
65+ run : ${{ env.BIN_PHPUNIT }} --verbose
Original file line number Diff line number Diff line change 11<?php
2+ /**
3+ * Provides flexibilty for using either simple-phpunit or phpunit
4+ */
25
36$ vendorBin = __DIR__ .'/../vendor/bin ' ;
7+
8+ // See if we using simple-phpunit
49$ path = realpath ($ vendorBin .'/simple-phpunit ' );
510
6- if (!file_exists ($ vendorBin .'/phpunit ' ) && $ path !== false ) {
7- passthru (escapeshellarg ($ path ).' install ' );
11+ if ($ path !== false ) {
12+ // simple-phpunit will update the .phpunit symlink/junction
13+ $ phpunit = escapeshellarg (PHP_BINARY ).' ' .escapeshellarg ($ path );
14+ passthru ($ phpunit .' install ' );
815
916 $ autoloader = $ vendorBin .'/.phpunit/phpunit/vendor/autoload.php ' ;
10- if (file_exists ($ autoloader )) {
11- require $ autoloader ;
17+ if (!file_exists ($ autoloader )) {
18+ echo 'Cannot run PHPStan: simple-phpunit did not install PHPUnit as expected ' .PHP_EOL ;
19+ exit (1 );
1220 }
21+
22+ include $ autoloader ;
23+ return ;
24+ }
25+
26+ if (realpath ($ vendorBin .'/phpunit ' ) === false ) {
27+ echo 'Cannot run PHPStan: PHPUnit has not been installed ' .PHP_EOL ;
28+ exit (1 );
1329}
You can’t perform that action at this time.
0 commit comments