@@ -37,16 +37,31 @@ jobs:
3737 key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
3838 restore-keys : ${{ runner.os }}-composer-
3939
40- - name : Delete composer lock file
40+ - name : Update PHPUnit version for PHP 8
4141 id : composer-lock
4242 if : " startsWith(matrix.php-version, '8.')"
4343 run : |
4444 rm -f composer.lock
4545 echo "::set-output name=flags::--ignore-platform-reqs"
46+ composer remove phpunit/phpunit --dev --no-update --no-interaction
47+ composer require phpunit/phpunit ^8.0 --dev --no-update
4648
4749 - name : Install dependencies
4850 run : composer update --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }}
4951
52+ - name : Update code to make PHPUnit 8 compatible
53+ if : " startsWith(matrix.php-version, '8.')"
54+ run : |
55+ find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function setUpBeforeClass()$/function setUpBeforeClass(): void/' {} \;
56+ find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function tearDownAfterClass()$/function tearDownAfterClass(): void/' {} \;
57+ find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function setUp()$/function setUp(): void/' {} \;
58+ find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function tearDown()$/function tearDown(): void/' {} \;
59+ find ./tests/ -name "*.php" -type f -exec sed -i -e 's/->assertContains(/->assertStringContainsString(/' {} \;
60+ find ./tests/ -name "*.php" -type f -exec sed -i -e 's/->assertNotContains(/->assertStringNotContainsString(/' {} \;
61+ find ./tests/ -name "*.php" -type f -exec sed -i -e "s/->assertInternalType('array', /->assertIsArray(/" {} \;
62+ sed -i "s/\$this->addWarning('The @expectedException,/\/\/\$this->addWarning('The @expectedException,/" ./vendor/phpunit/phpunit/src/Framework/TestCase.php
63+ sed -i "s/self::createWarning('The optional \$delta/\/\/self::createWarning('The optional \$delta/" ./vendor/phpunit/phpunit/src/Framework/Assert.php
64+
5065 - name : Setup problem matchers for PHP
5166 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
5267
5772 uses : mheap/phpunit-matcher-action@v1
5873
5974 - name : Test with PHPUnit
60- run : ./vendor/bin/phpunit --teamcity -c ./
75+ run : ./vendor/bin/phpunit --teamcity --no-coverage - c ./
6176
6277 php-cs-fixer :
6378 runs-on : ubuntu-latest
0 commit comments