Skip to content

Commit

Permalink
kill mutant
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Nov 14, 2024
1 parent e952de3 commit 1fcb086
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions tests/phpunit/src/Commands/App/LogTailCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
Expand Down Expand Up @@ -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');
Expand All @@ -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',
Expand All @@ -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();
Expand Down

0 comments on commit 1fcb086

Please sign in to comment.