From 2ae000cbade86717b1f401f37813ddc8b76deb62 Mon Sep 17 00:00:00 2001 From: troosan Date: Sun, 21 Feb 2021 21:32:45 +0100 Subject: [PATCH] hack for phpunit 8 compatibility --- .github/workflows/ci.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36820f9d..f1eac8f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,16 +37,31 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- - - name: Delete composer lock file + - name: Update PHPUnit version for PHP 8 id: composer-lock if: "startsWith(matrix.php-version, '8.')" run: | rm -f composer.lock echo "::set-output name=flags::--ignore-platform-reqs" + composer remove phpunit/phpunit --dev --no-update --no-interaction + composer require phpunit/phpunit ^8.0 --dev --no-update - name: Install dependencies run: composer update --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }} + - name: Update code to make PHPUnit 8 compatible + if: "startsWith(matrix.php-version, '8.')" + run: | + find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function setUpBeforeClass()$/function setUpBeforeClass(): void/' {} \; + find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function tearDownAfterClass()$/function tearDownAfterClass(): void/' {} \; + find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function setUp()$/function setUp(): void/' {} \; + find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function tearDown()$/function tearDown(): void/' {} \; + find ./tests/ -name "*.php" -type f -exec sed -i -e 's/->assertContains(/->assertStringContainsString(/' {} \; + find ./tests/ -name "*.php" -type f -exec sed -i -e 's/->assertNotContains(/->assertStringNotContainsString(/' {} \; + find ./tests/ -name "*.php" -type f -exec sed -i -e "s/->assertInternalType('array', /->assertIsArray(/" {} \; + sed -i "s/\$this->addWarning('The @expectedException,/\/\/\$this->addWarning('The @expectedException,/" ./vendor/phpunit/phpunit/src/Framework/TestCase.php + sed -i "s/self::createWarning('The optional \$delta/\/\/self::createWarning('The optional \$delta/" ./vendor/phpunit/phpunit/src/Framework/Assert.php + - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" @@ -57,7 +72,7 @@ jobs: uses: mheap/phpunit-matcher-action@v1 - name: Test with PHPUnit - run: ./vendor/bin/phpunit --teamcity -c ./ + run: ./vendor/bin/phpunit --teamcity --no-coverage -c ./ php-cs-fixer: runs-on: ubuntu-latest