hack for phpunit 8 compatibility
This commit is contained in:
parent
b71b4fdb71
commit
2ae000cbad
|
|
@ -37,16 +37,31 @@ jobs:
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
restore-keys: ${{ runner.os }}-composer-
|
restore-keys: ${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Delete composer lock file
|
- name: Update PHPUnit version for PHP 8
|
||||||
id: composer-lock
|
id: composer-lock
|
||||||
if: "startsWith(matrix.php-version, '8.')"
|
if: "startsWith(matrix.php-version, '8.')"
|
||||||
run: |
|
run: |
|
||||||
rm -f composer.lock
|
rm -f composer.lock
|
||||||
echo "::set-output name=flags::--ignore-platform-reqs"
|
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
|
- name: Install dependencies
|
||||||
run: composer update --no-progress --prefer-dist --optimize-autoloader ${{ steps.composer-lock.outputs.flags }}
|
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
|
- name: Setup problem matchers for PHP
|
||||||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||||
|
|
||||||
|
|
@ -57,7 +72,7 @@ jobs:
|
||||||
uses: mheap/phpunit-matcher-action@v1
|
uses: mheap/phpunit-matcher-action@v1
|
||||||
|
|
||||||
- name: Test with PHPUnit
|
- name: Test with PHPUnit
|
||||||
run: ./vendor/bin/phpunit --teamcity -c ./
|
run: ./vendor/bin/phpunit --teamcity --no-coverage -c ./
|
||||||
|
|
||||||
php-cs-fixer:
|
php-cs-fixer:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue