From 8cab5edea94ad6b76a163bb208ccdd60fbcbdedc Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 1 Apr 2021 22:16:16 +0200 Subject: [PATCH] Enable PHP 8.0 Auto-Test --- .github/workflows/php.yml | 9 +++++++-- tests/bootstrap.php | 6 ++++++ tests/legacy/ApiTest.php | 38 +++++++++++++++++++------------------- tests/phpunit-local.xml | 26 -------------------------- tests/phpunit.xml | 27 ++++++++++++++------------- 5 files changed, 46 insertions(+), 60 deletions(-) delete mode 100644 tests/phpunit-local.xml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 91a8b6074..edf31c1a0 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.2', '7.3', '7.4'] + php-versions: ['7.2', '7.3', '7.4', '8.0'] steps: - name: Checkout uses: actions/checkout@v2 @@ -62,6 +62,11 @@ jobs: - name: Install dependencies run: composer install --prefer-dist + - name: Install PHPUnit 8 + run: curl -O -L https://phar.phpunit.de/phpunit-8.phar + && chmod +x phpunit-8.phar + && mv phpunit-8.phar /usr/local/bin/phpunit + - name: Copy default Friendica config run: cp config/local-sample.config.php config/local.config.php @@ -83,7 +88,7 @@ jobs: run: vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ . - name: Test with phpunit - run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml + run: /usr/local/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml env: MYSQL_HOST: 127.0.0.1 MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 7201b6e63..34467b760 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -24,6 +24,12 @@ use Dice\Dice; use Friendica\DI; use PHPUnit\Framework\TestCase; +if (!file_exists(__DIR__ . '/../vendor/autoload.php')) { + die('Vendor path not found. Please execute "bin/composer.phar --no-dev install" on the command line in the web root.'); +} + +require __DIR__ . '/../vendor/autoload.php'; + // Backward compatibility if (!class_exists(TestCase::class)) { class_alias(PHPUnit_Framework_TestCase::class, TestCase::class); diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 89bddf31d..bced7eb19 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -300,9 +300,9 @@ class ApiTest extends FixtureTest /** * Test the api_login() function without any login. * - * @return void * @runInSeparateProcess * @preserveGlobalState disabled + * @preserveGlobalState disabled * @expectedException Friendica\Network\HTTPException\UnauthorizedException */ public function testApiLoginWithoutLogin() @@ -313,9 +313,9 @@ class ApiTest extends FixtureTest /** * Test the api_login() function with a bad login. * - * @return void * @runInSeparateProcess * @preserveGlobalState disabled + * @preserveGlobalState disabled * @expectedException Friendica\Network\HTTPException\UnauthorizedException */ public function testApiLoginWithBadLogin() @@ -347,8 +347,8 @@ class ApiTest extends FixtureTest /** * Test the api_login() function with a correct login. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled * @doesNotPerformAssertions */ public function testApiLoginWithCorrectLogin() @@ -361,8 +361,8 @@ class ApiTest extends FixtureTest /** * Test the api_login() function with a remote user. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled * @expectedException Friendica\Network\HTTPException\UnauthorizedException */ public function testApiLoginWithRemoteUser() @@ -405,8 +405,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCall() { @@ -432,8 +432,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with the profiled enabled. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithProfiler() { @@ -469,8 +469,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function without any result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithNoResult() { @@ -495,8 +495,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with an unimplemented API. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithUninplementedApi() { @@ -509,8 +509,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with a JSON result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithJson() { @@ -535,8 +535,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with an XML result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithXml() { @@ -561,8 +561,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with an RSS result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithRss() { @@ -588,8 +588,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with an Atom result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithAtom() { @@ -615,8 +615,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with an unallowed method. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithWrongMethod() { @@ -636,8 +636,8 @@ class ApiTest extends FixtureTest /** * Test the api_call() function with an unauthorized user. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiCallWithWrongAuth() { @@ -661,8 +661,8 @@ class ApiTest extends FixtureTest /** * Test the api_error() function with a JSON result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiErrorWithJson() { @@ -675,8 +675,8 @@ class ApiTest extends FixtureTest /** * Test the api_error() function with an XML result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiErrorWithXml() { @@ -696,8 +696,8 @@ class ApiTest extends FixtureTest /** * Test the api_error() function with an RSS result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiErrorWithRss() { @@ -717,8 +717,8 @@ class ApiTest extends FixtureTest /** * Test the api_error() function with an Atom result. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiErrorWithAtom() { @@ -860,8 +860,8 @@ class ApiTest extends FixtureTest /** * Test the api_get_user() function with an user that is not allowed to use the API. * - * @return void * @runInSeparateProcess + * @preserveGlobalState disabled */ public function testApiGetUserWithoutApiUser() { diff --git a/tests/phpunit-local.xml b/tests/phpunit-local.xml deleted file mode 100644 index 7bf174aba..000000000 --- a/tests/phpunit-local.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - functional/ - include/ - src/ - ./ - - - - - .. - - config/ - doc/ - images/ - library/ - spec/ - tests/ - view/ - - - - diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 8285a936d..c4197d3e4 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,29 +1,30 @@ + bootstrap="bootstrap.php" + verbose="true" + backupGlobals="false" + timeoutForSmallTests="900" + timeoutForMediumTests="900" + timeoutForLargeTests="900"> functional/ include/ src/ - ./ .. - ../config - ../doc - ../images - ../library - ../spec - ../tests - ../view + config/ + doc/ + images/ + library/ + spec/ + tests/ + view/ + vendor/ - - -