]> git.mxchange.org Git - friendica.git/commitdiff
Enable PHP 8.0 Auto-Test
authorPhilipp <admin@philipp.info>
Thu, 1 Apr 2021 20:16:16 +0000 (22:16 +0200)
committerPhilipp <admin@philipp.info>
Sun, 4 Apr 2021 18:11:56 +0000 (20:11 +0200)
.github/workflows/php.yml
tests/bootstrap.php
tests/legacy/ApiTest.php
tests/phpunit-local.xml [deleted file]
tests/phpunit.xml

index 91a8b60747aa4b3443ce63b675b6d39ceff820ec..edf31c1a0f616eff584f3f5c0095df24b73568a7 100644 (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] }}
index 7201b6e6316c108035f5c987feedb22886ce413d..34467b7607c75bda6490621e85f660561f56980f 100644 (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);
index 89bddf31d17aa4667dc6524ebd54e058612017b7..bced7eb19730301bce383a2ea620815e64ef6bc7 100644 (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()
        {
diff --git a/tests/phpunit-local.xml b/tests/phpunit-local.xml
deleted file mode 100644 (file)
index 7bf174a..0000000
+++ /dev/null
@@ -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>
index 8285a936d712297c995ed6bb96b14878449ca0b9..c4197d3e4ce4b57ffdbb072e862a99e51ed1461a 100644 (file)
@@ -1,29 +1,30 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <phpunit
-       bootstrap="bootstrap.php"
-       verbose="true">
+               bootstrap="bootstrap.php"
+               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>