PHP Class Longman\TelegramBot\Tests\Unit\TestHelpers

Datei anzeigen Open project: akalongman/php-telegram-bot Class Usage Examples

Protected Properties

Property Type Description
$chat_template array Data template of a chat.
$user_template array Data template of a user.

Public Methods

Method Description
emptyDB ( array $credentials ) Empty all tables for the passed database
getFakeChatObject ( array $data = [] ) : Chat Return a fake chat object.
getFakeMessageObject ( array $message_data = [], array $user_data = [], array $chat_data = [] ) : Message Return a fake message object using the passed ids.
getFakeRecordedAudio ( ) : array Get fake recorded audio track
getFakeUpdateCommandObject ( string $command_text ) : Update Return a fake command object for the passed command text
getFakeUpdateObject ( array $data = null ) : Update Return a simple fake Update object
getFakeUserObject ( array $data = [] ) : Longman\TelegramBot\Entities\User Return a fake user object.
setObjectProperty ( object $object, string $property, mixed $value ) Set the value of a private/protected property of an object
setStaticProperty ( string $class, string $property, mixed $value ) Set the value of a private/protected static property of a class
startFakeConversation ( ) : array Start a fake conversation for the passed command and return the randomly generated ids.

Method Details

emptyDB() public static method

Empty all tables for the passed database
public static emptyDB ( array $credentials )
$credentials array

getFakeChatObject() public static method

Return a fake chat object.
public static getFakeChatObject ( array $data = [] ) : Chat
$data array Pass custom data array if needed
return Longman\TelegramBot\Entities\Chat

getFakeMessageObject() public static method

Return a fake message object using the passed ids.
public static getFakeMessageObject ( array $message_data = [], array $user_data = [], array $chat_data = [] ) : Message
$message_data array Pass custom message data array if needed
$user_data array Pass custom user data array if needed
$chat_data array Pass custom chat data array if needed
return Longman\TelegramBot\Entities\Message

getFakeRecordedAudio() public static method

Get fake recorded audio track
public static getFakeRecordedAudio ( ) : array
return array

getFakeUpdateCommandObject() public static method

Return a fake command object for the passed command text
public static getFakeUpdateCommandObject ( string $command_text ) : Update
$command_text string
return Longman\TelegramBot\Entities\Update

getFakeUpdateObject() public static method

Return a simple fake Update object
public static getFakeUpdateObject ( array $data = null ) : Update
$data array Pass custom data array if needed
return Longman\TelegramBot\Entities\Update

getFakeUserObject() public static method

Return a fake user object.
public static getFakeUserObject ( array $data = [] ) : Longman\TelegramBot\Entities\User
$data array Pass custom data array if needed
return Longman\TelegramBot\Entities\User

setObjectProperty() public static method

Set the value of a private/protected property of an object
public static setObjectProperty ( object $object, string $property, mixed $value )
$object object Object that contains the property
$property string Name of the property who's value we want to set
$value mixed The value to set to the property

setStaticProperty() public static method

Set the value of a private/protected static property of a class
public static setStaticProperty ( string $class, string $property, mixed $value )
$class string Class that contains the static property
$property string Name of the property who's value we want to set
$value mixed The value to set to the property

startFakeConversation() public static method

Start a fake conversation for the passed command and return the randomly generated ids.
public static startFakeConversation ( ) : array
return array

Property Details

$chat_template protected_oe static_oe property

Data template of a chat.
protected static array $chat_template
return array

$user_template protected_oe static_oe property

Data template of a user.
protected static array $user_template
return array