Enable PHP 8.0 Auto-Test

This commit is contained in:
Philipp 2021-04-01 22:16:16 +02:00
parent 4b38b6aa16
commit 8cab5edea9
No known key found for this signature in database
GPG Key ID: 9A28B7D4FF5667BD
5 changed files with 46 additions and 60 deletions

View File

@ -28,7 +28,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
php-versions: ['7.2', '7.3', '7.4'] php-versions: ['7.2', '7.3', '7.4', '8.0']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -62,6 +62,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist 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 - name: Copy default Friendica config
run: cp config/local-sample.config.php config/local.config.php 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/ . run: vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ .
- name: Test with phpunit - 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: env:
MYSQL_HOST: 127.0.0.1 MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }} MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}

View File

@ -24,6 +24,12 @@ use Dice\Dice;
use Friendica\DI; use Friendica\DI;
use PHPUnit\Framework\TestCase; 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 // Backward compatibility
if (!class_exists(TestCase::class)) { if (!class_exists(TestCase::class)) {
class_alias(PHPUnit_Framework_TestCase::class, TestCase::class); class_alias(PHPUnit_Framework_TestCase::class, TestCase::class);

View File

@ -300,9 +300,9 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_login() function without any login. * Test the api_login() function without any login.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException * @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/ */
public function testApiLoginWithoutLogin() public function testApiLoginWithoutLogin()
@ -313,9 +313,9 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_login() function with a bad login. * Test the api_login() function with a bad login.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled * @preserveGlobalState disabled
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException * @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/ */
public function testApiLoginWithBadLogin() public function testApiLoginWithBadLogin()
@ -347,8 +347,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_login() function with a correct login. * Test the api_login() function with a correct login.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
* @doesNotPerformAssertions * @doesNotPerformAssertions
*/ */
public function testApiLoginWithCorrectLogin() public function testApiLoginWithCorrectLogin()
@ -361,8 +361,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_login() function with a remote user. * Test the api_login() function with a remote user.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException * @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/ */
public function testApiLoginWithRemoteUser() public function testApiLoginWithRemoteUser()
@ -405,8 +405,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function. * Test the api_call() function.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCall() public function testApiCall()
{ {
@ -432,8 +432,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with the profiled enabled. * Test the api_call() function with the profiled enabled.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithProfiler() public function testApiCallWithProfiler()
{ {
@ -469,8 +469,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function without any result. * Test the api_call() function without any result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithNoResult() public function testApiCallWithNoResult()
{ {
@ -495,8 +495,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with an unimplemented API. * Test the api_call() function with an unimplemented API.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithUninplementedApi() public function testApiCallWithUninplementedApi()
{ {
@ -509,8 +509,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with a JSON result. * Test the api_call() function with a JSON result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithJson() public function testApiCallWithJson()
{ {
@ -535,8 +535,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with an XML result. * Test the api_call() function with an XML result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithXml() public function testApiCallWithXml()
{ {
@ -561,8 +561,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with an RSS result. * Test the api_call() function with an RSS result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithRss() public function testApiCallWithRss()
{ {
@ -588,8 +588,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with an Atom result. * Test the api_call() function with an Atom result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithAtom() public function testApiCallWithAtom()
{ {
@ -615,8 +615,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with an unallowed method. * Test the api_call() function with an unallowed method.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithWrongMethod() public function testApiCallWithWrongMethod()
{ {
@ -636,8 +636,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_call() function with an unauthorized user. * Test the api_call() function with an unauthorized user.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiCallWithWrongAuth() public function testApiCallWithWrongAuth()
{ {
@ -661,8 +661,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_error() function with a JSON result. * Test the api_error() function with a JSON result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiErrorWithJson() public function testApiErrorWithJson()
{ {
@ -675,8 +675,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_error() function with an XML result. * Test the api_error() function with an XML result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiErrorWithXml() public function testApiErrorWithXml()
{ {
@ -696,8 +696,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_error() function with an RSS result. * Test the api_error() function with an RSS result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiErrorWithRss() public function testApiErrorWithRss()
{ {
@ -717,8 +717,8 @@ class ApiTest extends FixtureTest
/** /**
* Test the api_error() function with an Atom result. * Test the api_error() function with an Atom result.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiErrorWithAtom() 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. * Test the api_get_user() function with an user that is not allowed to use the API.
* *
* @return void
* @runInSeparateProcess * @runInSeparateProcess
* @preserveGlobalState disabled
*/ */
public function testApiGetUserWithoutApiUser() public function testApiGetUserWithoutApiUser()
{ {

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit
bootstrap="bootstrap.php"
verbose="true">
<testsuite name='friendica'>
<directory suffix='.php'>functional/</directory>
<directory suffix='.php'>include/</directory>
<directory suffix='.php'>src/</directory>
<directory suffix='.php'>./</directory>
</testsuite>
<!-- Filters for Code Coverage -->
<filter>
<whitelist>
<directory suffix=".php">..</directory>
<exclude>
<directory suffix=".php">config/</directory>
<directory suffix=".php">doc/</directory>
<directory suffix=".php">images/</directory>
<directory suffix=".php">library/</directory>
<directory suffix=".php">spec/</directory>
<directory suffix=".php">tests/</directory>
<directory suffix=".php">view/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

View File

@ -1,29 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<phpunit <phpunit
bootstrap="bootstrap.php" bootstrap="bootstrap.php"
verbose="true"> verbose="true"
backupGlobals="false"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900">
<testsuite name='friendica'> <testsuite name='friendica'>
<directory suffix='.php'>functional/</directory> <directory suffix='.php'>functional/</directory>
<directory suffix='.php'>include/</directory> <directory suffix='.php'>include/</directory>
<directory suffix='.php'>src/</directory> <directory suffix='.php'>src/</directory>
<directory suffix='.php'>./</directory>
</testsuite> </testsuite>
<!-- Filters for Code Coverage --> <!-- Filters for Code Coverage -->
<filter> <filter>
<whitelist> <whitelist>
<directory suffix=".php">..</directory> <directory suffix=".php">..</directory>
<exclude> <exclude>
<directory suffix=".php">../config</directory> <directory suffix=".php">config/</directory>
<directory suffix=".php">../doc</directory> <directory suffix=".php">doc/</directory>
<directory suffix=".php">../images</directory> <directory suffix=".php">images/</directory>
<directory suffix=".php">../library</directory> <directory suffix=".php">library/</directory>
<directory suffix=".php">../spec</directory> <directory suffix=".php">spec/</directory>
<directory suffix=".php">../tests</directory> <directory suffix=".php">tests/</directory>
<directory suffix=".php">../view</directory> <directory suffix=".php">view/</directory>
<directory suffix=".php">vendor/</directory>
</exclude> </exclude>
</whitelist> </whitelist>
</filter> </filter>
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
</phpunit> </phpunit>