Skip to content

Commit

Permalink
Merge pull request ben-xo#52 from ben-xo/feature/simplify-composer
Browse files Browse the repository at this point in the history
Feature/simplify composer
  • Loading branch information
ben-xo authored Dec 31, 2021
2 parents 5dcd693 + 75fe060 commit fd1a187
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ jobs:
uses: actions/checkout@v2
- name: Composer Install
uses: ramsey/composer-install@v2
with:
working-directory: "test"
- name: Test with phpunit (MacOS, Linux)
if: ${{ ! contains(matrix.operating-system, 'windows') }}
run: ./test/run.sh --do-not-cache-result .
- name: Test with phpunit (Windows)
if: ${{ contains(matrix.operating-system, 'windows') }}
run: cd test ; ..\vendor\bin\phpunit --bootstrap "bootstrap.php" .
run: cd test ; vendor\bin\phpunit --bootstrap "bootstrap.php" .

2 changes: 1 addition & 1 deletion test/combine_coverage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

require_once('../vendor/autoload.php');
require_once('vendor/autoload.php');

use SebastianBergmann\CodeCoverage\Report\Text as PHP_CodeCoverage_Report_Text;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/dir2castWithCoverage.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

require_once('../../vendor/autoload.php');
require_once('../vendor/autoload.php');

use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\Driver\Selector;
Expand Down
11 changes: 10 additions & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

cd "$SCRIPT_DIR"

if [[ ! -e vendor ]]; then
echo "Error: Make sure you have php, composer and xdebug installed, then do 'composer install'"
echo "On a typical MacOS that would be the following commands:"
echo " brew install php composer"
echo " pecl install xdebug"
echo " composer install"
exit 1
fi

tests=($@)
if [[ "${tests[@]}" == "" ]]; then
tests=('.')
fi

export XDEBUG_MODE=coverage
rm -f /tmp/cov-*
../vendor/bin/phpunit --bootstrap "$SCRIPT_DIR/bootstrap.php" --coverage-php /tmp/cov-main --coverage-filter ../dir2cast.php ${tests[@]}
vendor/bin/phpunit --bootstrap "$SCRIPT_DIR/bootstrap.php" --coverage-php /tmp/cov-main --coverage-filter ../dir2cast.php ${tests[@]}
php combine_coverage.php
rm -rf testdir /tmp/cov-*

0 comments on commit fd1a187

Please sign in to comment.