Skip to content

Commit

Permalink
kill mutant
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Oct 16, 2024
1 parent e91ca09 commit 68618f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/phpunit/src/Commands/Pull/PullCommandTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,17 @@ protected function mockListSites(SshHelper|ObjectProphecy $sshHelper): void
->willReturn($process->reveal())->shouldBeCalled();
}

public function mockGetBackup(mixed $environment): void
public function mockGetBackup(mixed $environment, bool $perms = true): void
{
if (!$perms) {
$tamper = static function ($databases): void {
$databases[0]->user_name = null;
};
$this->mockRequest('getEnvironmentsDatabases', $environment->id, null, null, $tamper);
return;
}
$databases = $this->mockRequest('getEnvironmentsDatabases', $environment->id);
$tamper = function ($backups): void {
$tamper = static function ($backups): void {
$backups[0]->completedAt = $backups[0]->completed_at;
};
$backups = new BackupsResponse(
Expand Down
16 changes: 16 additions & 0 deletions tests/phpunit/src/Commands/Pull/PullDatabaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,22 @@ public function testPullDatabaseWithMySqlImportError(): void
], self::inputChooseEnvironment());
}

public function testPullDatabaseWithMissingPermission(): void
{
$localMachineHelper = $this->mockLocalMachineHelper();
$this->mockExecuteMySqlConnect($localMachineHelper, true);
$environment = $this->mockGetEnvironment();
$sshHelper = $this->mockSshHelper();
$this->mockListSites($sshHelper);
$this->mockGetBackup($environment, false);

$this->expectException(AcquiaCliException::class);
$this->expectExceptionMessage('Database connection details missing');
$this->executeCommand([
'--no-scripts' => true,
], self::inputChooseEnvironment());
}

/**
* @dataProvider providerTestPullDatabaseWithInvalidSslCertificate
*/
Expand Down

0 comments on commit 68618f3

Please sign in to comment.