Skip to content

CLI-1330: TypeError for SSH commands on Node environments #2278

CLI-1330: TypeError for SSH commands on Node environments

CLI-1330: TypeError for SSH commands on Node environments #2278

Triggered via pull request April 25, 2024 22:20
Status Failure
Total duration 11m 52s
Artifacts

mutation.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

1 error and 10 warnings
Mutation Testing
Process completed with exit code 1.
Mutation Testing: src/Command/CommandBase.php#L577
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ $chosenDatabaseIndex = array_search($chosenDatabaseLabel, $choices, TRUE); return [$environmentDatabases[$chosenDatabaseIndex]]; } - protected function determineEnvironment(InputInterface $input, OutputInterface $output, bool $allowProduction = FALSE, bool $allowNode = TRUE) : array|string|EnvironmentResponse + protected function determineEnvironment(InputInterface $input, OutputInterface $output, bool $allowProduction = true, bool $allowNode = TRUE) : array|string|EnvironmentResponse { if ($input->getArgument('environmentId')) { $environmentId = $input->getArgument('environmentId');
Mutation Testing: src/Command/CommandBase.php#L577
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ $chosenDatabaseIndex = array_search($chosenDatabaseLabel, $choices, TRUE); return [$environmentDatabases[$chosenDatabaseIndex]]; } - protected function determineEnvironment(InputInterface $input, OutputInterface $output, bool $allowProduction = FALSE, bool $allowNode = TRUE) : array|string|EnvironmentResponse + protected function determineEnvironment(InputInterface $input, OutputInterface $output, bool $allowProduction = FALSE, bool $allowNode = false) : array|string|EnvironmentResponse { if ($input->getArgument('environmentId')) { $environmentId = $input->getArgument('environmentId');
Mutation Testing: src/Command/CommandBase.php#L595
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ return $chosenEnvironment; } // Todo: obviously combine this with promptChooseEnvironment. - private function promptChooseEnvironmentConsiderProd(Client $acquiaCloudClient, string $applicationUuid, bool $allowProduction = FALSE, bool $allowNode = TRUE) : EnvironmentResponse + private function promptChooseEnvironmentConsiderProd(Client $acquiaCloudClient, string $applicationUuid, bool $allowProduction = true, bool $allowNode = TRUE) : EnvironmentResponse { $environmentResource = new Environments($acquiaCloudClient); $applicationEnvironments = iterator_to_array($environmentResource->getAll($applicationUuid));
Mutation Testing: src/Command/CommandBase.php#L595
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ return $chosenEnvironment; } // Todo: obviously combine this with promptChooseEnvironment. - private function promptChooseEnvironmentConsiderProd(Client $acquiaCloudClient, string $applicationUuid, bool $allowProduction = FALSE, bool $allowNode = TRUE) : EnvironmentResponse + private function promptChooseEnvironmentConsiderProd(Client $acquiaCloudClient, string $applicationUuid, bool $allowProduction = FALSE, bool $allowNode = false) : EnvironmentResponse { $environmentResource = new Environments($acquiaCloudClient); $applicationEnvironments = iterator_to_array($environmentResource->getAll($applicationUuid));
Mutation Testing: src/Command/CommandBase.php#L601
Escaped Mutant for Mutator "LogicalNot": --- Original +++ New @@ @@ $choices = []; foreach ($applicationEnvironments as $key => $environment) { $productionNotAllowed = !$allowProduction && $environment->flags->production; - $nodeNotAllowed = !$allowNode && $environment->type === 'node'; + $nodeNotAllowed = $allowNode && $environment->type === 'node'; if ($productionNotAllowed || $nodeNotAllowed) { unset($applicationEnvironments[$key]); // Re-index array so keys match those in $choices.
Mutation Testing: src/Command/CommandBase.php#L602
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ foreach ($applicationEnvironments as $key => $environment) { $productionNotAllowed = !$allowProduction && $environment->flags->production; $nodeNotAllowed = !$allowNode && $environment->type === 'node'; - if ($productionNotAllowed || $nodeNotAllowed) { + if ($productionNotAllowed && $nodeNotAllowed) { unset($applicationEnvironments[$key]); // Re-index array so keys match those in $choices. $applicationEnvironments = array_values($applicationEnvironments);
Mutation Testing: src/Command/CommandBase.php#L1335
Escaped Mutant for Mutator "ProtectedVisibility": --- Original +++ New @@ @@ /** * @return array<mixed> */ - protected function getAcsfSites(EnvironmentResponse $cloudEnvironment) : array + private function getAcsfSites(EnvironmentResponse $cloudEnvironment) : array { $envAlias = self::getEnvironmentAlias($cloudEnvironment); $command = ['cat', "/var/www/site-php/{$envAlias}/multisite-config.json"];
Mutation Testing: src/Command/CommandBase.php#L1688
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ protected function getAnyNonProdAhEnvironment(string $cloudAppUuid) : EnvironmentResponse|false { return $this->getAnyAhEnvironment($cloudAppUuid, function (EnvironmentResponse $environment) { - return !$environment->flags->production && $environment->type === 'drupal'; + return !$environment->flags->production || $environment->type === 'drupal'; }); } /**
Mutation Testing: src/Command/Pull/PullDatabaseCommand.php#L43
Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ // $noImport implies $noScripts. $noScripts = $noImport || $noScripts; $this->setDirAndRequireProjectCwd($input); - $sourceEnvironment = $this->determineEnvironment($input, $output, TRUE, FALSE); + $sourceEnvironment = $this->determineEnvironment($input, $output, TRUE, true); $this->pullDatabase($input, $output, $sourceEnvironment, $onDemand, $noImport, $multipleDbs); if (!$noScripts) { $this->runDrushCacheClear($this->getOutputCallback($output, $this->checklist), $this->checklist);
Mutation Testing: src/Command/Pull/PullFilesCommand.php#L25
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ protected function execute(InputInterface $input, OutputInterface $output) : int { $this->setDirAndRequireProjectCwd($input); - $sourceEnvironment = $this->determineEnvironment($input, $output, TRUE, FALSE); + $sourceEnvironment = $this->determineEnvironment($input, $output, false, FALSE); $this->pullFiles($input, $output, $sourceEnvironment); return Command::SUCCESS; } }