Replies: 3 comments
-
Why? Just do this: $bot
->hearText('/start')
->reply()
->assertReplyText('Hello world!')); More informations: https://nutgram.dev/docs/testing/asserting |
Beta Was this translation helpful? Give feedback.
-
What if I want to use the result of one message to send the next? For example:
In this example, I send a message to the bot and receive an inline keyboard. I would like to be able to emulate pressing a button |
Beta Was this translation helpful? Give feedback.
-
Hearing a callback query data should be in another test. public function test_callback_query_data(): void
{
$bot = app(Nutgram::class);
$bot->hearCallbackQueryData('your-callback-data')
->reply();
//assert...
} If you want to test that the response has a button with a certain |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
It would be great to be able to receive a response from the bot in an array format in tests (similar to how we can get a
json
response from a regularPOST
request)Describe the solution you'd like
An option to solve the problem is to add a new function to
FakeNutgram
:Describe alternatives you've considered
No response
Additional context
It would be convenient to receive the response as an array and use it in other requests to the bot or data assertions.
Example of use in Laravel tests:
Beta Was this translation helpful? Give feedback.
All reactions