Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Oct 16, 2019
1 parent 1f5f0b5 commit b6b00f8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/EventListener/ConsoleListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testOnConsoleCommandAddsCommandName(): void
$this->assertSame(['command' => 'sf:command:name'], $this->getTagsContext($this->currentScope));
}

public function testOnConsoleCommandAddsPlaceholderCommandName(): void
public function testOnConsoleCommandWithNoCommandAddsPlaceholder(): void
{
$event = $this->prophesize(ConsoleCommandEvent::class);
$event->getCommand()
Expand All @@ -64,6 +64,23 @@ public function testOnConsoleCommandAddsPlaceholderCommandName(): void
$this->assertSame(['command' => 'N/A'], $this->getTagsContext($this->currentScope));
}

public function testOnConsoleCommandWithNoCommandNameAddsPlaceholder(): void
{
$command = $this->prophesize(Command::class);
$command->getName()
->willReturn(null);

$event = $this->prophesize(ConsoleCommandEvent::class);
$event->getCommand()
->willReturn($command->reveal());

$listener = new ConsoleListener($this->currentHub->reveal());

$listener->onConsoleCommand($event->reveal());

$this->assertSame(['command' => 'N/A'], $this->getTagsContext($this->currentScope));
}

private function getTagsContext(Scope $scope): array
{
$event = new Event();
Expand Down

0 comments on commit b6b00f8

Please sign in to comment.