mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-17 11:13:06 +00:00
Added editBotInfo & editChat & getVideoAttachmentDetails
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Tests\Models;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Payloads\PhotoAttachmentRequestPayload;
|
||||
use BushlanovDev\MaxMessengerBot\Models\BotPatch;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use PHPUnit\Framework\Attributes\UsesClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
#[CoversClass(BotPatch::class)]
|
||||
#[UsesClass(PhotoAttachmentRequestPayload::class)]
|
||||
final class BotPatchTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function toArrayIncludesOnlyExplicitlySetFields(): void
|
||||
{
|
||||
$patch = new BotPatch(name: 'New Name');
|
||||
$this->assertEquals(['name' => 'New Name'], $patch->toArray());
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function toArrayIncludesFieldsSetToNull(): void
|
||||
{
|
||||
$patch = new BotPatch(description: null);
|
||||
$this->assertEquals(['description' => null], $patch->toArray());
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function toArrayHandlesMultipleSetFields(): void
|
||||
{
|
||||
$photoPayload = new PhotoAttachmentRequestPayload(token: 'photo123');
|
||||
$patch = new BotPatch(
|
||||
name: 'Updated Bot',
|
||||
description: null,
|
||||
photo: $photoPayload
|
||||
);
|
||||
|
||||
$expected = [
|
||||
'name' => 'Updated Bot',
|
||||
'description' => null,
|
||||
'photo' => [
|
||||
'url' => null,
|
||||
'token' => 'photo123',
|
||||
'photos' => null,
|
||||
],
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, $patch->toArray());
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function toArrayIsEmptyWhenNoArgumentsPassed(): void
|
||||
{
|
||||
$patch = new BotPatch();
|
||||
$this->assertEmpty($patch->toArray());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user