Skip to content

Commit 6b99923

Browse files
committed
travis php 8 - convert tests from phpunit 7 format to phpunit 8 format
1 parent 4cc2cc1 commit 6b99923

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.travis.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,23 @@ before_script:
5959
## Composer in PHP versions 5.x requires 3 GB memory
6060
- if [ ${TRAVIS_PHP_VERSION:0:2} == "5." ]; then export COMPOSER_MEMORY_LIMIT=3G ; fi
6161
- travis_wait composer install --prefer-source $(if [ -n "$DEPENDENCIES" ]; then echo $DEPENDENCIES; fi)
62-
## PHP 8 require PHPUnit 8
62+
## PHP 8 require PHPUnit 8 (ugly hack for support PHPUnit 7 and 8 together)
6363
- |
6464
if [[ ${TRAVIS_PHP_VERSION:0:2} == "8." ]] || [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
6565
travis_wait composer remove phpunit/phpunit --dev --no-interaction --ignore-platform-reqs
6666
travis_wait composer require phpunit/phpunit ^8.0 --dev --ignore-platform-reqs
67+
68+
find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function setUpBeforeClass()$/function setUpBeforeClass(): void/' {} \;
69+
find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function tearDownAfterClass()$/function tearDownAfterClass(): void/' {} \;
70+
find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function setUp()$/function setUp(): void/' {} \;
71+
find ./tests/ -name "*.php" -type f -exec sed -i -e 's/function tearDown()$/function tearDown(): void/' {} \;
72+
73+
find ./tests/ -name "*.php" -type f -exec sed -i -e 's/->assertContains(/->assertStringContainsString(/' {} \;
74+
find ./tests/ -name "*.php" -type f -exec sed -i -e 's/->assertNotContains(/->assertStringNotContainsString(/' {} \;
75+
find ./tests/ -name "*.php" -type f -exec sed -i -e "s/->assertInternalType('array', /->assertIsArray(/" {} \;
76+
77+
sed -i "s/\$this->addWarning('The @expectedException,/\/\/\$this->addWarning('The @expectedException,/" ./vendor/phpunit/phpunit/src/Framework/TestCase.php
78+
sed -i "s/self::createWarning('The optional \$delta/\/\/self::createWarning('The optional \$delta/" ./vendor/phpunit/phpunit/src/Framework/Assert.php
6779
fi
6880
## PHPDocumentor
6981
##- mkdir -p build/docs

0 commit comments

Comments
 (0)