Skip to content

Commit b6b00f8

Browse files
committed
Add test
1 parent 1f5f0b5 commit b6b00f8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/EventListener/ConsoleListenerTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testOnConsoleCommandAddsCommandName(): void
5151
$this->assertSame(['command' => 'sf:command:name'], $this->getTagsContext($this->currentScope));
5252
}
5353

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

67+
public function testOnConsoleCommandWithNoCommandNameAddsPlaceholder(): void
68+
{
69+
$command = $this->prophesize(Command::class);
70+
$command->getName()
71+
->willReturn(null);
72+
73+
$event = $this->prophesize(ConsoleCommandEvent::class);
74+
$event->getCommand()
75+
->willReturn($command->reveal());
76+
77+
$listener = new ConsoleListener($this->currentHub->reveal());
78+
79+
$listener->onConsoleCommand($event->reveal());
80+
81+
$this->assertSame(['command' => 'N/A'], $this->getTagsContext($this->currentScope));
82+
}
83+
6784
private function getTagsContext(Scope $scope): array
6885
{
6986
$event = new Event();

0 commit comments

Comments
 (0)