Skip to content

CLI-1226: Support objects as API params (#1646) #2020

CLI-1226: Support objects as API params (#1646)

CLI-1226: Support objects as API params (#1646) #2020

Triggered via push December 11, 2023 22:20
Status Success
Total duration 11m 57s
Artifacts

mutation.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
Mutation Testing: src/AcsfApi/AcsfClient.php#L15
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ public function processResponse(ResponseInterface $response) : mixed { $bodyJson = $response->getBody(); - $body = json_decode((string) $bodyJson, FALSE, 512, JSON_THROW_ON_ERROR); + $body = json_decode((string) $bodyJson, FALSE, 511, JSON_THROW_ON_ERROR); // ACSF sometimes returns an array rather than an object. if (is_array($body)) { return $body;
Mutation Testing: src/AcsfApi/AcsfClient.php#L15
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ public function processResponse(ResponseInterface $response) : mixed { $bodyJson = $response->getBody(); - $body = json_decode((string) $bodyJson, FALSE, 512, JSON_THROW_ON_ERROR); + $body = json_decode((string) $bodyJson, FALSE, 513, JSON_THROW_ON_ERROR); // ACSF sometimes returns an array rather than an object. if (is_array($body)) { return $body;
Mutation Testing: src/AcsfApi/AcsfClient.php#L30
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ throw new ApiErrorException($body); } // Throw error for 4xx and 5xx responses. - if (property_exists($body, 'message') && in_array(substr((string) $response->getStatusCode(), 0, 1), ['4', '5'], TRUE)) { + if (property_exists($body, 'message') || in_array(substr((string) $response->getStatusCode(), 0, 1), ['4', '5'], TRUE)) { $body->error = $response->getStatusCode(); throw new ApiErrorException($body); }
Mutation Testing: src/AcsfApi/AcsfClientService.php#L18
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function getClient() : AcsfClient { $client = AcsfClient::factory($this->connector); - $this->configureClient($client); + return $client; } protected function checkAuthentication() : bool
Mutation Testing: src/CloudApi/ClientService.php#L67
Escaped Mutant for Mutator "ProtectedVisibility": --- Original +++ New @@ @@ $this->machineIsAuthenticated = $this->checkAuthentication(); return $this->machineIsAuthenticated; } - protected function checkAuthentication() : bool + private function checkAuthentication() : bool { return $this->credentials->getCloudAccessToken() || $this->credentials->getCloudKey() && $this->credentials->getCloudSecret(); } }
Mutation Testing: src/CloudApi/CloudCredentials.php#L43
Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ if (!file_exists($file)) { throw new AcquiaCliException('Access token expiry file not found at {file}', ['file' => $file]); } - return trim(file_get_contents($file), "\"\n"); + return file_get_contents($file); } return NULL; }
Mutation Testing: src/CloudApi/CloudCredentials.php#L54
Escaped Mutant for Mutator "IfNegation": --- Original +++ New @@ @@ if ($key = getenv('ACLI_KEY')) { return $key; } - if ($this->datastoreCloud->get('acli_key')) { + if (!$this->datastoreCloud->get('acli_key')) { return $this->datastoreCloud->get('acli_key'); } return NULL;
Mutation Testing: src/CloudApi/CloudCredentials.php#L67
Escaped Mutant for Mutator "IfNegation": --- Original +++ New @@ @@ return $secret; } $acliKey = $this->getCloudKey(); - if ($this->datastoreCloud->get('keys')) { + if (!$this->datastoreCloud->get('keys')) { $keys = $this->datastoreCloud->get('keys'); if (is_array($keys) && array_key_exists($acliKey, $keys)) { return $this->datastoreCloud->get('keys')[$acliKey]['secret'];
Mutation Testing: src/CloudApi/CloudCredentials.php#L69
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $acliKey = $this->getCloudKey(); if ($this->datastoreCloud->get('keys')) { $keys = $this->datastoreCloud->get('keys'); - if (is_array($keys) && array_key_exists($acliKey, $keys)) { + if (is_array($keys) || array_key_exists($acliKey, $keys)) { return $this->datastoreCloud->get('keys')[$acliKey]['secret']; } }
Mutation Testing: src/CloudApi/CloudCredentials.php#L69
Escaped Mutant for Mutator "LogicalAndAllSubExprNegation": --- Original +++ New @@ @@ $acliKey = $this->getCloudKey(); if ($this->datastoreCloud->get('keys')) { $keys = $this->datastoreCloud->get('keys'); - if (is_array($keys) && array_key_exists($acliKey, $keys)) { + if (!is_array($keys) && !array_key_exists($acliKey, $keys)) { return $this->datastoreCloud->get('keys')[$acliKey]['secret']; } }