Skip to content

Commit

Permalink
fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Apr 18, 2024
1 parent 30424b2 commit 8b2c3c7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Command/Api/ApiBaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions tests/phpunit/src/Commands/Api/ApiBaseCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types = 1);

namespace Acquia\Cli\Tests\Commands\Api;

use Acquia\Cli\Command\Api\ApiBaseCommand;
use Acquia\Cli\Command\CommandBase;
use Acquia\Cli\Exception\AcquiaCliException;
use Acquia\Cli\Tests\CommandTestBase;

class ApiBaseCommandTest extends CommandTestBase {

protected function createCommand(): CommandBase {
return $this->injectCommand(ApiBaseCommand::class);
}

public function testApiBaseCommand(): void {
$this->expectException(AcquiaCliException::class);
$this->expectExceptionMessage('api:base is not a valid command');
$this->executeCommand();
}

}

0 comments on commit 8b2c3c7

Please sign in to comment.