From 8b2c3c72381b3d63c525c3d27e6bd9cbfcb7c859 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 18 Apr 2024 10:45:32 -0700 Subject: [PATCH] fix test case --- src/Command/Api/ApiBaseCommand.php | 2 ++ .../src/Commands/Api/ApiBaseCommandTest.php | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/phpunit/src/Commands/Api/ApiBaseCommandTest.php diff --git a/src/Command/Api/ApiBaseCommand.php b/src/Command/Api/ApiBaseCommand.php index c4d5d5992..1a9a743e6 100644 --- a/src/Command/Api/ApiBaseCommand.php +++ b/src/Command/Api/ApiBaseCommand.php @@ -110,6 +110,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $response = $acquiaCloudClient->request($this->method, $path); $exitCode = 0; } + // Ignore PhpStorm warning here. + // @see https://youtrack.jetbrains.com/issue/WI-77190/Exception-is-never-thrown-when-thrown-from-submethod catch (ApiErrorException $exception) { $response = $exception->getResponseBody(); $exitCode = 1; diff --git a/tests/phpunit/src/Commands/Api/ApiBaseCommandTest.php b/tests/phpunit/src/Commands/Api/ApiBaseCommandTest.php new file mode 100644 index 000000000..6cf4a8f5f --- /dev/null +++ b/tests/phpunit/src/Commands/Api/ApiBaseCommandTest.php @@ -0,0 +1,24 @@ +injectCommand(ApiBaseCommand::class); + } + + public function testApiBaseCommand(): void { + $this->expectException(AcquiaCliException::class); + $this->expectExceptionMessage('api:base is not a valid command'); + $this->executeCommand(); + } + +}