mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-10-07 04:20:42 +00:00
Allow comment_removed without post_id
The schema lists post_id as required, but the official TypeScript client types it as `string | null`. A null would fail with a TypeError and, unlike an unknown update type, TypeError is not caught while parsing updates.
This commit is contained in:
@@ -31,4 +31,20 @@ final class CommentRemovedUpdateTest extends TestCase
|
||||
$this->assertSame(42, $update->userId);
|
||||
$this->assertSame('mid.post', $update->postId);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function postIdMayBeNull(): void
|
||||
{
|
||||
// The official TypeScript client types post_id as `string | null`
|
||||
$update = CommentRemovedUpdate::fromArray([
|
||||
'update_type' => UpdateType::CommentRemoved->value,
|
||||
'timestamp' => 1678886400000,
|
||||
'message_id' => 'mid.comment',
|
||||
'chat_id' => -100,
|
||||
'user_id' => 42,
|
||||
'post_id' => null,
|
||||
]);
|
||||
|
||||
$this->assertNull($update->postId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user