diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index 0bcb5bb0a..6cea3db08 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -965,6 +965,10 @@ protected static function getThisCloudIdeLabel(): false|string { return getenv('REMOTEIDE_LABEL'); } + protected static function getThisCloudIdeWebUrl(): false|string { + return getenv('REMOTEIDE_WEB_HOST'); + } + protected function getCloudApplication(string $applicationUuid): ApplicationResponse { $applicationsResource = new Applications($this->cloudApiClientService->getClient()); return $applicationsResource->get($applicationUuid); diff --git a/src/Command/Ide/IdeShareCommand.php b/src/Command/Ide/IdeShareCommand.php index 5d671b601..46fdf0d5a 100644 --- a/src/Command/Ide/IdeShareCommand.php +++ b/src/Command/Ide/IdeShareCommand.php @@ -6,7 +6,6 @@ use Acquia\Cli\Command\CommandBase; use Acquia\DrupalEnvironmentDetector\AcquiaDrupalEnvironmentDetector; -use AcquiaCloudApi\Endpoints\Ides; use Ramsey\Uuid\Uuid; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; @@ -36,12 +35,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int } $shareUuid = $this->localMachineHelper->readFile($this->getShareCodeFilepaths()[0]); - $acquiaCloudClient = $this->cloudApiClientService->getClient(); - $idesResource = new Ides($acquiaCloudClient); - $ide = $idesResource->get($this::getThisCloudIdeUuid()); + $webUrl = self::getThisCloudIdeWebUrl(); $this->output->writeln(''); - $this->output->writeln("Your IDE Share URL: links->web->href}>{$ide->links->web->href}?share=$shareUuid"); + $this->output->writeln("Your IDE Share URL: https://$webUrl?share=$shareUuid"); return Command::SUCCESS; } diff --git a/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php b/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php index aa9cfe3ee..f0bbf6e0a 100644 --- a/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php +++ b/tests/phpunit/src/Commands/Ide/IdeShareCommandTest.php @@ -7,7 +7,6 @@ use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Command\Ide\IdeShareCommand; use Acquia\Cli\Tests\CommandTestBase; -use AcquiaCloudApi\Response\IdeResponse; use Symfony\Component\Console\Output\OutputInterface; /** @@ -41,24 +40,14 @@ protected function createCommand(): CommandBase { } public function testIdeShareCommand(): void { - $ideGetResponse = $this->mockRequest('getIde', IdeHelper::$remoteIdeUuid); - $ide = new IdeResponse((object) $ideGetResponse); $this->executeCommand(); - - // Assert. - $output = $this->getDisplay(); $this->assertStringContainsString('Your IDE Share URL: ', $output); $this->assertStringContainsString($this->shareCode, $output); } public function testIdeShareRegenerateCommand(): void { - $ideGetResponse = $this->mockRequest('getIde', IdeHelper::$remoteIdeUuid); - $ide = new IdeResponse((object) $ideGetResponse); - $this->executeCommand(['--regenerate' => TRUE], []); - - // Assert. - + $this->executeCommand(['--regenerate' => TRUE]); $output = $this->getDisplay(); $this->assertStringContainsString('Your IDE Share URL: ', $output); $this->assertStringNotContainsString($this->shareCode, $output);