@@ -37,16 +37,31 @@ jobs:
37
37
key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
38
38
restore-keys : ${{ runner.os }}-composer-
39
39
40
- - name : Delete composer lock file
40
+ - name : Update PHPUnit version for PHP 8
41
41
id : composer-lock
42
42
if : " startsWith(matrix.php-version, '8.')"
43
43
run : |
44
44
rm -f composer.lock
45
45
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
46
48
47
49
- name : Install dependencies
48
50
run : composer update --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }}
49
51
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
+
50
65
- name : Setup problem matchers for PHP
51
66
run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
52
67
57
72
uses : mheap/phpunit-matcher-action@v1
58
73
59
74
- name : Test with PHPUnit
60
- run : ./vendor/bin/phpunit --teamcity -c ./
75
+ run : ./vendor/bin/phpunit --teamcity --no-coverage - c ./
61
76
62
77
php-cs-fixer :
63
78
runs-on : ubuntu-latest
0 commit comments