Skip to content

Kill 2 more mutants by using PHP named arguments. #1761

Kill 2 more mutants by using PHP named arguments.

Kill 2 more mutants by using PHP named arguments. #1761

Triggered via push June 19, 2023 16:44
Status Success
Total duration 11m 36s
Artifacts
This run and associated checks have been archived and are scheduled for deletion. Learn more about checks retention

mutation.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
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#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/ConnectorFactory.php#L24
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ public function createConnector() : Connector|AccessTokenConnector { // A defined key & secret takes priority. - if ($this->config['key'] && $this->config['secret']) { + if ($this->config['key'] || $this->config['secret']) { return new Connector($this->config, $this->baseUri, $this->accountsUri); } // Fall back to a valid access token.
Mutation Testing: src/Command/Acsf/AcsfApiAuthLoginCommand.php#L62
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $users['add_new'] = ['username' => 'Enter a new user']; $selectedUser = $this->promptChooseFromObjectsOrArrays($users, 'username', 'username', 'Choose which user to login as'); if ($selectedUser['username'] !== 'Enter a new user') { - $this->datastoreCloud->set('acsf_active_factory', $factoryUrl); + $factories[$factoryUrl]['active_user'] = $selectedUser['username']; $this->datastoreCloud->set('acsf_factories', $factories); $output->writeln(["<info>Acquia CLI is now logged in to <options=bold>{$factory['url']}</> as <options=bold>{$selectedUser['username']}</></info>"]);
Mutation Testing: src/Command/Acsf/AcsfApiAuthLoginCommand.php#L64
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ if ($selectedUser['username'] !== 'Enter a new user') { $this->datastoreCloud->set('acsf_active_factory', $factoryUrl); $factories[$factoryUrl]['active_user'] = $selectedUser['username']; - $this->datastoreCloud->set('acsf_factories', $factories); + $output->writeln(["<info>Acquia CLI is now logged in to <options=bold>{$factory['url']}</> as <options=bold>{$selectedUser['username']}</></info>"]); return Command::SUCCESS; }
Mutation Testing: src/Command/Acsf/AcsfApiAuthLogoutCommand.php#L29
Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ protected function execute(InputInterface $input, OutputInterface $output) : int { if (!$this->cloudApiClientService->isMachineAuthenticated()) { - $this->io->error(['You are not logged into any factories.']); + $this->io->error([]); return 1; } $factories = $this->datastoreCloud->get('acsf_factories');
Mutation Testing: src/Command/Acsf/AcsfApiAuthLogoutCommand.php#L29
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ protected function execute(InputInterface $input, OutputInterface $output) : int { if (!$this->cloudApiClientService->isMachineAuthenticated()) { - $this->io->error(['You are not logged into any factories.']); + return 1; } $factories = $this->datastoreCloud->get('acsf_factories');
Mutation Testing: src/Command/Acsf/AcsfApiAuthLogoutCommand.php#L30
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { if (!$this->cloudApiClientService->isMachineAuthenticated()) { $this->io->error(['You are not logged into any factories.']); - return 1; + return 0; } $factories = $this->datastoreCloud->get('acsf_factories'); foreach ($factories as $url => $factory) {