Skip to content

Commit

Permalink
improve if conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it committed Mar 5, 2019
1 parent eafb148 commit f380b84
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions tests/acceptance/features/bootstrap/CorsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit f380b84

Please sign in to comment.