diff --git a/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php b/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php index 5f03bb4ec..c034dfc51 100644 --- a/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php +++ b/tests/phpunit/src/Commands/Auth/AuthLogoutCommandTest.php @@ -8,6 +8,7 @@ use Acquia\Cli\Command\CommandBase; use Acquia\Cli\Config\CloudDataConfig; use Acquia\Cli\DataStore\CloudDataStore; +use Acquia\Cli\Exception\AcquiaCliException; use Acquia\Cli\Tests\CommandTestBase; /** @@ -31,4 +32,25 @@ public function testAuthLogoutCommand(): void { $this->assertStringContainsString('The active Cloud Platform API credentials were deactivated', $output); } + public function testAuthLogoutInvalidDatastore(): void { + $this->clientServiceProphecy->isMachineAuthenticated()->willReturn(FALSE); + $this->removeMockCloudConfigFile(); + $data = [ + 'acli_key' => 'key2', + 'keys' => [ + 'key1' => [ + 'label' => 'foo', + 'secret' => 'foo', + 'uuid' => 'foo', + ], + ], + ]; + $this->fs->dumpFile($this->cloudConfigFilepath, json_encode($data)); + $this->createDataStores(); + $this->command = $this->createCommand(); + $this->expectException(AcquiaCliException::class); + $this->expectExceptionMessage("Invalid key in datastore at $this->cloudConfigFilepath"); + $this->executeCommand(); + } + }