Skip to main content
Version: 4.x

Hearing updates

Overview

After you have configured your first testcase, to test your handlers you have to define which update it will process. To do that, the framework gives you some methods to automatically generate incoming updates.

Example

We assume that the $this->bot is loaded as mentioned on the Introduction page.

$this
->bot
->hearText('/foo')
->reply();

Available Methods

hearUpdate

The hearUpdate hears an outcoming Update object.

->hearUpdate(new Update());

hearUpdateType

The hearUpdateType hears an outcoming Update subtype array. The partialAttributes and fillNullableFields parameters are optionals.

->hearUpdateType(UpdateTypes::MESSAGE, partialAttributes: ['text' => '/foo'], fillNullableFields: false);

hearMessage

The hearMessage hears an outcoming Message array.

->hearMessage(['text' => 'foo']);

hearText

The hearText hears an outcoming Message text.

->hearText('foo');

hearCallbackQueryData

The hearCallbackQueryData hears an outcoming CallbackQuery data.

->hearCallbackQueryData('baz');