Skip to content

Commit

Permalink
kill mutants
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Apr 5, 2024
1 parent 2b67307 commit 28cb517
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Command/CommandBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ protected function promptChooseLogs(): object|array|null {
* @param array[]|object[] $items An array of objects or arrays.
* @param string $uniqueProperty The property of the $item that will be used to identify the object.
*/
public function promptChooseFromObjectsOrArrays(array|ArrayObject $items, string $uniqueProperty, string $labelProperty, string $questionText, bool $multiselect = FALSE): object|array|null {
protected function promptChooseFromObjectsOrArrays(array|ArrayObject $items, string $uniqueProperty, string $labelProperty, string $questionText, bool $multiselect = FALSE): object|array|null {
$list = [];
foreach ($items as $item) {
if (is_array($item)) {
Expand Down
24 changes: 22 additions & 2 deletions tests/phpunit/src/Commands/App/LogTailCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Acquia\Cli\Command\CommandBase;
use Acquia\Cli\Tests\CommandTestBase;
use AcquiaLogstream\LogstreamManager;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;

/**
Expand All @@ -17,8 +18,24 @@ class LogTailCommandTest extends CommandTestBase {

protected LogstreamManager|ObjectProphecy $logStreamManagerProphecy;

/**
* @return int[]
*/
public function providerLogTailCommand(): array {
return [
[0],
[NULL],
];
}

protected function createCommand(): CommandBase {
// Must initialize this here instead of in setUp() because we need the
// prophet to be initialized first.
$this->logStreamManagerProphecy = $this->prophet->prophesize(LogstreamManager::class);
$this->logStreamManagerProphecy->setColourise(TRUE)->shouldBeCalled();
$this->logStreamManagerProphecy->setParams(Argument::type('object'))->shouldBeCalled();
$this->logStreamManagerProphecy->setLogTypeFilter(["bal-request"])->shouldBeCalled();
$this->logStreamManagerProphecy->stream()->shouldBeCalled();

return new LogTailCommand(
$this->localMachineHelper,
Expand All @@ -35,7 +52,10 @@ protected function createCommand(): CommandBase {
);
}

public function testLogTailCommand(): void {
/**
* @dataProvider providerLogTailCommand
*/
public function testLogTailCommand(?int $stream): void {
$this->mockGetEnvironment();
$this->mockLogStreamRequest();
$this->executeCommand([], [
Expand All @@ -48,7 +68,7 @@ public function testLogTailCommand(): void {
// Select environment.
0,
// Select log.
0,
$stream,
]);

// Assert.
Expand Down

0 comments on commit 28cb517

Please sign in to comment.