From f380b84b2f7ec28b238d045bb3bf875c7c60c700 Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Tue, 5 Mar 2019 11:12:36 +0545 Subject: [PATCH] improve if conditions --- .../features/bootstrap/CorsContext.php | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/acceptance/features/bootstrap/CorsContext.php b/tests/acceptance/features/bootstrap/CorsContext.php index 8aa51214eda7..c1843915526a 100644 --- a/tests/acceptance/features/bootstrap/CorsContext.php +++ b/tests/acceptance/features/bootstrap/CorsContext.php @@ -54,22 +54,19 @@ public function addDomainToPrivateCORSLists($user, $domain) { 'domains' ] ); - $domains = []; if ($this->featureContext->getExitStatusCodeOfOccCommand() === 0) { - $domains = \json_decode($this->featureContext->getStdOutOfOccCommand()); - //the admin is not deleted after the tests, so better reset the cors setting - if ($user === $this->featureContext->getAdminUsername() - && $this->originalAdminCorsDomains === null - ) { - $this->originalAdminCorsDomains - = $this->featureContext->getStdOutOfOccCommand(); - } - } elseif ($user === $this->featureContext->getAdminUsername() + $domainsJson = $this->featureContext->getStdOutOfOccCommand(); + $domains = \json_decode($domainsJson); + } else { + $domainsJson = ""; + $domains = []; + } + if ($user === $this->featureContext->getAdminUsername() && $this->originalAdminCorsDomains === null ) { - //exit code was not 0, so no CORS domain was set - $this->originalAdminCorsDomains = ""; + $this->originalAdminCorsDomains = $domainsJson; } + $domains[] = $domain; $valueString = \json_encode($domains);