diff --git a/tests/phpunit/src/Commands/App/LogTailCommandTest.php b/tests/phpunit/src/Commands/App/LogTailCommandTest.php index 1d2b9e9c6..0e682f829 100644 --- a/tests/phpunit/src/Commands/App/LogTailCommandTest.php +++ b/tests/phpunit/src/Commands/App/LogTailCommandTest.php @@ -73,7 +73,7 @@ public function testLogTailCommand(?int $stream): void // Would you like to link the project at ... ? 'y', // Select environment. - 2, + 0, // Select log. $stream, ]); @@ -103,6 +103,34 @@ public function testLogTailCommandWithEnvArg(): void $this->assertStringContainsString('Drupal request', $output); } + public function testLogTailProd(): void + { + $applications = $this->mockRequest('getApplications'); + $application = $this->mockRequest('getApplicationByUuid', $applications[self::$INPUT_DEFAULT_CHOICE]->uuid); + $this->mockRequest('getApplicationEnvironments', $application->uuid); + $this->mockLogStreamRequest('15-a47ac10b-58cc-4372-a567-0e02b2c3d470'); + $this->executeCommand( + [], + [ + // Would you like Acquia CLI to search for a Cloud application that matches your local git config? + 'n', + // Select the application. + 0, + // Would you like to link the project at ... ? + 'y', + // Select environment. + 1, + // Select log. + 0, + ] + ); + + // Assert. + $output = $this->getDisplay(); + $this->assertStringContainsString('Apache request', $output); + $this->assertStringContainsString('Drupal request', $output); + } + public function testLogTailNode(): void { $applications = $this->mockRequest('getApplications'); @@ -129,7 +157,7 @@ public function testLogTailNode(): void ]); } - private function mockLogStreamRequest(): void + private function mockLogStreamRequest(string $environment = '24-a47ac10b-58cc-4372-a567-0e02b2c3d470'): void { $response = self::getMockResponseFromSpec( '/environments/{environmentId}/logstream', @@ -138,7 +166,7 @@ private function mockLogStreamRequest(): void ); $this->clientProphecy->request( 'get', - '/environments/24-a47ac10b-58cc-4372-a567-0e02b2c3d470/logstream' + '/environments/' . $environment . '/logstream' ) ->willReturn($response) ->shouldBeCalled();