1
1
Fork 0

Enable PHP 8.0 Auto-Test

This commit is contained in:
Philipp Holzer 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:
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] }}

View file

@ -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);

View file

@ -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()
{

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" ?>
<phpunit
bootstrap="bootstrap.php"
verbose="true">
verbose="true"
backupGlobals="false"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900">
<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>
<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>
<directory suffix=".php">vendor/</directory>
</exclude>
</whitelist>
</filter>
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
</phpunit>