Skip to content

Commit a751682

Browse files
committed
test: add JSON output test for nutgram:list command
1 parent a9c9c3c commit a751682

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/Commands/ListTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,18 @@ public function bar(Nutgram $bot)
7373
->doesntExpectOutput('No handlers have been registered.')
7474
->assertSuccessful();
7575
});
76+
77+
test('nutgram:list with --json flag', function(){
78+
$bot = Nutgram::fake();
79+
80+
$bot->onCommand('start', static function () {});
81+
82+
$jsonOutput = [
83+
['handler' => 'onCommand', 'pattern' => '/start', 'callable' => 'closure'],
84+
];
85+
86+
$this
87+
->artisan(ListCommand::class, ['--json' => true])
88+
->expectsOutputToContain(json_encode($jsonOutput))
89+
->assertSuccessful();
90+
});

0 commit comments

Comments
 (0)