diff --git a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php index c601a8a98..9d42d6120 100644 --- a/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeDeleteCommandTest.php @@ -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); diff --git a/tests/phpunit/src/Commands/Ide/IdeHelper.php b/tests/phpunit/src/Commands/Ide/IdeHelper.php index 15b09fa02..3f261723a 100644 --- a/tests/phpunit/src/Commands/Ide/IdeHelper.php +++ b/tests/phpunit/src/Commands/Ide/IdeHelper.php @@ -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()); @@ -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, ]; } diff --git a/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php b/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php index 09999118d..046139177 100644 --- a/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/Wizard/IdeWizardDeleteSshKeyCommandTest.php @@ -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); diff --git a/tests/phpunit/src/TestBase.php b/tests/phpunit/src/TestBase.php index 09c97cf39..4dc128af1 100644 --- a/tests/phpunit/src/TestBase.php +++ b/tests/phpunit/src/TestBase.php @@ -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();