File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments