Skip to content

Commit

Permalink
kill mutant
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Apr 22, 2024
1 parent 4d8e7e8 commit d935d0b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testArchiveExport(): void {
$localMachineHelper->getFilesystem()->willReturn($fileSystem->reveal())->shouldBeCalled();
$this->mockExecutePvExists($localMachineHelper);
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, TRUE, $this->projectDir);
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$this->mockCreateMySqlDumpOnLocal($localMachineHelper);
$localMachineHelper->checkRequiredBinariesExist(["tar"])->shouldBeCalled();
$localMachineHelper->execute(Argument::type('array'), Argument::type('callable'), NULL, TRUE)->willReturn($this->mockProcess())->shouldBeCalled();
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/src/Commands/Pull/PullCodeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testWithScripts(): void {
$this->mockExecuteComposerExists($localMachineHelper);
$this->mockExecuteComposerInstall($localMachineHelper, $process);
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, TRUE, $this->projectDir);
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);

$this->executeCommand([], self::inputChooseEnvironment());
Expand All @@ -139,7 +139,7 @@ public function testNoComposerJson(): void {
$this->mockExecuteGitStatus(FALSE, $localMachineHelper, $this->projectDir);
$process = $this->mockProcess();
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, TRUE, $this->projectDir);
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);

$this->executeCommand([], self::inputChooseEnvironment());
Expand Down Expand Up @@ -169,7 +169,7 @@ public function testNoComposer(): void {
->willReturn(FALSE)
->shouldBeCalled();
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, TRUE, $this->projectDir);
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);

$this->executeCommand([], self::inputChooseEnvironment());
Expand Down Expand Up @@ -198,7 +198,7 @@ public function testWithVendorDir(): void {
$process = $this->mockProcess();
$this->mockExecuteComposerExists($localMachineHelper);
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, TRUE, $this->projectDir);
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);

$this->executeCommand([], self::inputChooseEnvironment());
Expand Down
5 changes: 2 additions & 3 deletions tests/phpunit/src/Commands/Pull/PullCommandTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ protected function mockExecuteDrushExists(

protected function mockExecuteDrushStatus(
ObjectProphecy $localMachineHelper,
mixed $hasConnection,
string $dir = NULL
): void {
$drushStatusProcess = $this->prophet->prophesize(Process::class);
$drushStatusProcess->isSuccessful()->willReturn($hasConnection);
$drushStatusProcess->getExitCode()->willReturn($hasConnection ? 0 : 1);
$drushStatusProcess->isSuccessful()->willReturn(TRUE);
$drushStatusProcess->getExitCode()->willReturn(0);
$drushStatusProcess->getOutput()
->willReturn(json_encode(['db-status' => 'Connected']));
$localMachineHelper
Expand Down
7 changes: 6 additions & 1 deletion tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ public function testPullDatabases(): void {
$this->mockExecuteMySqlImport($localMachineHelper, TRUE, TRUE, 'my_db', 'my_dbdev', 'drupal');
$fs->remove(Argument::type('string'))->shouldBeCalled();
$localMachineHelper->getFilesystem()->willReturn($fs)->shouldBeCalled();
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$process = $this->mockProcess();
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);
$this->mockExecuteDrushSqlSanitize($localMachineHelper, $process);

$this->executeCommand([
'--no-scripts' => TRUE,
'--no-scripts' => FALSE,
], self::inputChooseEnvironment());

$output = $this->getDisplay();
Expand Down
11 changes: 4 additions & 7 deletions tests/phpunit/src/Commands/Pull/PullScriptsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ public function testRefreshScripts(): void {
$this->mockExecuteComposerInstall($localMachineHelper, $process);

// Drush.
$drushConnectionExists = TRUE;
$this->mockExecuteDrushExists($localMachineHelper);
$this->mockExecuteDrushStatus($localMachineHelper, $drushConnectionExists, $this->projectDir);
if ($drushConnectionExists) {
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);
$this->mockExecuteDrushSqlSanitize($localMachineHelper, $process);
}
$this->mockExecuteDrushStatus($localMachineHelper, $this->projectDir);
$this->mockExecuteDrushCacheRebuild($localMachineHelper, $process);
$this->mockExecuteDrushSqlSanitize($localMachineHelper, $process);

$inputs = [
// Would you like Acquia CLI to search for a Cloud application that matches your local git config?
Expand All @@ -50,7 +47,7 @@ public function testRefreshScripts(): void {
'--dir' => $this->projectDir,
], $inputs);

$output = $this->getDisplay();
$this->getDisplay();
}

}

0 comments on commit d935d0b

Please sign in to comment.