From: Pierre Rudloff Date: Wed, 18 Jul 2018 20:30:55 +0000 (+0200) Subject: Fix tests (#5400) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6e1ed0b0d33ce3f893397eeb25909269402cf6bd;p=friendica.git Fix tests (#5400) * Avoid argc side-effects * Fix undefined array keys in JITConfigAdapter::set() * Avoid argv side effects in ApiTest --- diff --git a/src/Core/Config/JITConfigAdapter.php b/src/Core/Config/JITConfigAdapter.php index 96e4305ea3..527c718ae0 100644 --- a/src/Core/Config/JITConfigAdapter.php +++ b/src/Core/Config/JITConfigAdapter.php @@ -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; } diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 4e27290195..4d19994e35 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -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