mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-10-08 12:58:34 +00:00
Added ChatButton & ReplyButtons
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Tests\Models\Attachments\Buttons\Inline;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\ChatButton;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(ChatButton::class)]
|
||||
final class ChatButtonTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function toArrayWithRequiredParameters(): void
|
||||
{
|
||||
$button = new ChatButton(
|
||||
text: 'Discuss Topic',
|
||||
chatTitle: 'Topic Discussion',
|
||||
);
|
||||
|
||||
$expected = [
|
||||
'type' => 'chat',
|
||||
'text' => 'Discuss Topic',
|
||||
'chat_title' => 'Topic Discussion',
|
||||
'chat_description' => null,
|
||||
'start_payload' => null,
|
||||
'uuid' => null,
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $button->toArray());
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function toArrayWithAllParameters(): void
|
||||
{
|
||||
$button = new ChatButton(
|
||||
text: 'Join Project Chat',
|
||||
chatTitle: 'Project Alpha Chat',
|
||||
chatDescription: 'Chat for team members of Project Alpha.',
|
||||
startPayload: 'project-alpha-join',
|
||||
uuid: 123456789
|
||||
);
|
||||
|
||||
$expected = [
|
||||
'type' => 'chat',
|
||||
'text' => 'Join Project Chat',
|
||||
'chat_title' => 'Project Alpha Chat',
|
||||
'chat_description' => 'Chat for team members of Project Alpha.',
|
||||
'start_payload' => 'project-alpha-join',
|
||||
'uuid' => 123456789,
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $button->toArray());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user