Skip to content

Commit

Permalink
reorder sites in question
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Jan 7, 2025
1 parent e62becf commit 3be9d41
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,10 @@ private function getCloudSites(EnvironmentResponse $cloudEnvironment): array
$process = $this->sshHelper->executeCommand($cloudEnvironment->sshUrl, $command, false);
$sites = array_filter(explode("\n", trim($process->getOutput())));
if ($process->isSuccessful() && $sites) {
if ($key = array_search('default', $sites, true)) {
unset($sites[$key]);
$sites = array_merge([0 => 'default'], $sites);

Check warning on line 1414 in src/Command/CommandBase.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ if ($process->isSuccessful() && $sites) { if ($key = array_search('default', $sites, true)) { unset($sites[$key]); - $sites = array_merge([0 => 'default'], $sites); + $sites = array_merge([-1 => 'default'], $sites); } return $sites; }

Check warning on line 1414 in src/Command/CommandBase.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ if ($process->isSuccessful() && $sites) { if ($key = array_search('default', $sites, true)) { unset($sites[$key]); - $sites = array_merge([0 => 'default'], $sites); + $sites = array_merge([1 => 'default'], $sites); } return $sites; }
}
return $sites;
}

Expand Down
4 changes: 0 additions & 4 deletions src/Command/Pull/PullCommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,6 @@ private function determineSite(string|EnvironmentResponse|array $environment, In
return $input->getArgument('site');
}

if (!$this->input->isInteractive()) {
return 'default';
}

$this->site = $this->promptChooseDrupalSite($environment);

return $this->site;
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/src/Commands/Pull/PullCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testPull(): void
$this->mockGetFilesystem($localMachineHelper);
$parts = explode('.', $environment->ssh_url);
$sitegroup = reset($parts);
$this->mockExecuteRsync($localMachineHelper, $environment, '/mnt/files/' . $sitegroup . '.' . $environment->name . '/sites/bar/files/', $this->projectDir . '/docroot/sites/bar/files');
$this->mockExecuteRsync($localMachineHelper, $environment, '/mnt/files/' . $sitegroup . '.' . $environment->name . '/sites/default/files/', $this->projectDir . '/docroot/sites/default/files');
$this->command->sshHelper = $sshHelper->reveal();

// Pull database.
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/src/Commands/Pull/PullFilesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testRefreshCloudFiles(): void
$this->mockGetFilesystem($localMachineHelper);
$parts = explode('.', $selectedEnvironment->ssh_url);
$sitegroup = reset($parts);
$this->mockExecuteRsync($localMachineHelper, $selectedEnvironment, '/mnt/files/' . $sitegroup . '.' . $selectedEnvironment->name . '/sites/bar/files/', $this->projectDir . '/docroot/sites/bar/files');
$this->mockExecuteRsync($localMachineHelper, $selectedEnvironment, '/mnt/files/' . $sitegroup . '.' . $selectedEnvironment->name . '/sites/default/files/', $this->projectDir . '/docroot/sites/default/files');

$this->command->sshHelper = $sshHelper->reveal();

Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/src/Commands/Push/PushFilesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ protected function mockExecuteCloudRsync(
'rsync',
'-avPhze',
'ssh -o StrictHostKeyChecking=no',
$this->projectDir . '/docroot/sites/bar/files/',
$environment->ssh_url . ':/mnt/files/' . $sitegroup . '.' . $environment->name . '/sites/bar/files',
$this->projectDir . '/docroot/sites/default/files/',
$environment->ssh_url . ':/mnt/files/' . $sitegroup . '.' . $environment->name . '/sites/default/files',
];
$localMachineHelper->execute($command, Argument::type('callable'), null, true)
->willReturn($process->reveal())
Expand Down

0 comments on commit 3be9d41

Please sign in to comment.