]> git.mxchange.org Git - friendica.git/commitdiff
Fix tests (#5400)
authorPierre Rudloff <contact@rudloff.pro>
Wed, 18 Jul 2018 20:30:55 +0000 (22:30 +0200)
committerHypolite Petovan <mrpetovan@eml.cc>
Wed, 18 Jul 2018 20:30:55 +0000 (16:30 -0400)
* Avoid argc side-effects

* Fix undefined array keys in JITConfigAdapter::set()

* Avoid argv side effects in ApiTest

src/Core/Config/JITConfigAdapter.php
tests/ApiTest.php

index 96e4305ea39e87f38c226b0930c543fa8cb139e1..527c718ae0a2a6648d63f08303994b172d5a1fdc 100644 (file)
@@ -96,6 +96,13 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
 
                $stored = $this->get($cat, $k, null, true);
 
+               if (!isset($this->in_db[$cat])) {
+                       $this->in_db[$cat] = [];
+               }
+               if (!isset($this->in_db[$cat][$k])) {
+                       $this->in_db[$cat] = false;
+               }
+
                if (($stored === $dbvalue) && $this->in_db[$cat][$k]) {
                        return true;
                }
index 4e272901955b6197f388aec13d14b4906a302c85..4d19994e35e9ab0aece2286edd46bdc47c38791f 100644 (file)
@@ -68,6 +68,18 @@ class ApiTest extends DatabaseTest
                Config::set('system', 'theme', 'system_theme');
        }
 
+       /**
+        * Cleanup variables used by tests.
+        */
+       protected function tearDown()
+       {
+               parent::tearDown();
+
+               $app = get_app();
+               $app->argc = 1;
+               $app->argv = ['home'];
+       }
+
        /**
         * Assert that an user array contains expected keys.
         * @param array $user User array