From 9190b522c8fbb033e431285c168e0d061376e1d4 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 26 Nov 2023 10:31:59 +0100 Subject: [PATCH] run tests via blackbox --- .gitattributes | 1 - .github/workflows/ci.yml | 14 +++++++------- .gitignore | 2 -- blackbox.php | 27 +++++++++++++++++++++++++++ composer.json | 1 - phpunit.xml.dist | 25 ------------------------- tests/ApplicationTest.php | 2 +- tests/FunctionalTest.php | 2 +- 8 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 blackbox.php delete mode 100644 phpunit.xml.dist diff --git a/.gitattributes b/.gitattributes index 4160131..05f17e3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ /.gitattributes export-ignore /.gitignore export-ignore -/phpunit.xml.dist export-ignore /tests export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 483ace7..0605909 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,14 +3,14 @@ name: CI on: [push] jobs: - phpunit: + blackbox: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macOS-latest] php-version: ['8.2', '8.3'] dependencies: ['lowest', 'highest'] - name: 'PHPUnit' + name: 'BlackBox' steps: - name: Checkout uses: actions/checkout@v2 @@ -24,8 +24,8 @@ jobs: uses: "ramsey/composer-install@v2" with: dependency-versions: ${{ matrix.dependencies }} - - name: PHPUnit - run: vendor/bin/phpunit + - name: BlackBox + run: php blackbox.php coverage: runs-on: ${{ matrix.os }} strategy: @@ -47,10 +47,10 @@ jobs: uses: "ramsey/composer-install@v2" with: dependency-versions: ${{ matrix.dependencies }} - - name: PHPUnit - run: vendor/bin/phpunit --coverage-clover=coverage.clover + - name: BlackBox + run: php blackbox.php env: - BLACKBOX_SET_SIZE: 1 + ENABLE_COVERAGE: 'true' - uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 7330583..987e2a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ composer.lock vendor -.phpunit.result.cache -.phpunit.cache diff --git a/blackbox.php b/blackbox.php new file mode 100644 index 0000000..50022e2 --- /dev/null +++ b/blackbox.php @@ -0,0 +1,27 @@ +when( + \getenv('ENABLE_COVERAGE') !== false, + static fn(Application $app) => $app + ->codeCoverage( + CodeCoverage::of( + __DIR__.'/src/', + __DIR__.'/tests/', + ) + ->dumpTo('coverage.clover') + ->enableWhen(true), + ) + ->scenariiPerProof(1), + ) + ->tryToProve(Load::directory(__DIR__.'/tests/')) + ->exit(); diff --git a/composer.json b/composer.json index accaf9e..fc4a20c 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,6 @@ } }, "require-dev": { - "phpunit/phpunit": "~10.2", "vimeo/psalm": "~5.6", "innmind/black-box": "~5.5", "innmind/coding-standard": "~2.0", diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 1b215d5..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - ./tests - - - - - . - - - ./tests - ./vendor - - - diff --git a/tests/ApplicationTest.php b/tests/ApplicationTest.php index 5190e5d..6c9abbe 100644 --- a/tests/ApplicationTest.php +++ b/tests/ApplicationTest.php @@ -36,10 +36,10 @@ Map, Str, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ PHPUnit\BlackBox, Set, + PHPUnit\Framework\TestCase, }; use Fixtures\Innmind\Url\Url as FUrl; diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 6016b6e..0d6f8cb 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -18,7 +18,7 @@ ProtocolVersion, }; use Innmind\Url\Url; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class FunctionalTest extends TestCase {