mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-10-07 12:29:11 +00:00
Add fields and markup added in schema 0.0.33
- Recipient::$postId: the commented post, set for comments - ContactAttachmentPayload::$hash: hash of the VCF info - ChatPatch: document the description field (up to 16000 chars, empty string removes it) - QuoteMarkup and MarkupType::Quote. createMarkupElement() threw "Unknown or unsupported markup type" on a quote block, so a message with a quote could not be parsed at all New constructor parameters are optional and last, so existing positional calls keep working; toArray() of these models now also carries the new keys.
This commit is contained in:
@@ -10,6 +10,7 @@ use BushlanovDev\MaxMessengerBot\Models\Markup\HeadingMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\HighlightedMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\LinkMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\MonospacedMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\QuoteMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\StrikethroughMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\StrongMarkup;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Markup\UnderlineMarkup;
|
||||
@@ -27,6 +28,7 @@ use PHPUnit\Framework\TestCase;
|
||||
#[CoversClass(EmphasizedMarkup::class)]
|
||||
#[CoversClass(HeadingMarkup::class)]
|
||||
#[CoversClass(HighlightedMarkup::class)]
|
||||
#[CoversClass(QuoteMarkup::class)]
|
||||
final class MarkupTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
@@ -140,4 +142,17 @@ final class MarkupTest extends TestCase
|
||||
$this->assertSame(4, $markup->length);
|
||||
$this->assertEquals($data, $markup->toArray());
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function quoteMarkupIsCreatedCorrectly(): void
|
||||
{
|
||||
$data = ['type' => 'quote', 'from' => 0, 'length' => 12];
|
||||
$markup = QuoteMarkup::fromArray($data);
|
||||
|
||||
$this->assertInstanceOf(QuoteMarkup::class, $markup);
|
||||
$this->assertSame(MarkupType::Quote, $markup->type);
|
||||
$this->assertSame(0, $markup->from);
|
||||
$this->assertSame(12, $markup->length);
|
||||
$this->assertEquals($data, $markup->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user