Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Apr 17, 2024
1 parent aea7f0b commit f3736a8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@ protected function createCommand(): CommandBase {
return $this->injectCommand(IdeDeleteCommand::class);
}

/**
* @group brokenProphecy
*/
public function testIdeDeleteCommand(): void {
$applications = $this->mockRequest('getApplications');
$this->mockRequest('getApplicationByUuid', $applications[0]->uuid);
$ides = $this->mockRequest('getApplicationIdes', $applications[0]->uuid);
$this->mockRequest('deleteIde', $ides[0]->uuid, NULL, 'De-provisioning IDE');
$sshKeyGetResponse = $this->mockListSshKeysRequestWithIdeKey();
$sshKeyGetResponse = $this->mockListSshKeysRequestWithIdeKey($ides[0]->label, $ides[0]->uuid);

$this->mockDeleteSshKeyRequest($sshKeyGetResponse->{'_embedded'}->items[0]->uuid);

Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/src/Commands/Ide/IdeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class IdeHelper {

public static string $remoteIdeUuid = '215824ff-272a-4a8c-9027-df32ed1d68a9';
public static string $remoteIdeLabel = 'ExampleIDE';

public static function setCloudIdeEnvVars(): void {
TestBase::setEnvVars(self::getEnvVars());
Expand All @@ -25,7 +26,7 @@ public static function getEnvVars(): array {
return [
'ACQUIA_USER_UUID' => '4acf8956-45df-3cf4-5106-065b62cf1ac8',
'AH_SITE_ENVIRONMENT' => 'IDE',
'REMOTEIDE_LABEL' => 'ExampleIDE',
'REMOTEIDE_LABEL' => self::$remoteIdeLabel,
'REMOTEIDE_UUID' => self::$remoteIdeUuid,
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class IdeWizardDeleteSshKeyCommandTest extends IdeWizardTestBase {

public function testDelete(): void {
$mockBody = $this->mockListSshKeysRequestWithIdeKey();
$mockBody = $this->mockListSshKeysRequestWithIdeKey(IdeHelper::$remoteIdeLabel, IdeHelper::$remoteIdeUuid);

$this->mockDeleteSshKeyRequest($mockBody->{'_embedded'}->items[0]->uuid);

Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/src/TestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,9 @@ protected function mockListSshKeysRequest(): array {
return $this->mockRequest('getAccountSshKeys');
}

protected function mockListSshKeysRequestWithIdeKey(): object {
protected function mockListSshKeysRequestWithIdeKey(string $ideLabel, string $ideUuid): object {
$mockBody = $this->getMockResponseFromSpec('/account/ssh-keys', 'get', '200');
$mockBody->{'_embedded'}->items[0]->label = 'IDE_ExampleIDE_215824ff272a4a8c9027df32ed1d68a9';
$mockBody->{'_embedded'}->items[0]->label = preg_replace('/\W/', '', 'IDE_' . $ideLabel . '_' . $ideUuid);
$this->clientProphecy->request('get', '/account/ssh-keys')
->willReturn($mockBody->{'_embedded'}->items)
->shouldBeCalled();
Expand Down

0 comments on commit f3736a8

Please sign in to comment.