mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-17 16:21:36 +00:00
SendMessage method add recipient
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Tests\Models;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Models\Recipient;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(Recipient::class)]
|
||||
class RecipientTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function canBeCreatedFromArray(): void
|
||||
{
|
||||
$data = [
|
||||
'chat_type' => 'chat',
|
||||
'chat_id' => 123,
|
||||
];
|
||||
|
||||
$receipt = Recipient::fromArray($data);
|
||||
|
||||
$this->assertInstanceOf(Recipient::class, $receipt);
|
||||
$this->assertSame($data['chat_type'], $receipt->chatType->value);
|
||||
$this->assertSame($data['chat_id'], $receipt->chatId);
|
||||
|
||||
$array = $receipt->toArray();
|
||||
|
||||
$this->assertIsArray($array);
|
||||
unset($array['user_id']);
|
||||
$this->assertSame($data, $array);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user