Added OpenAppButton factory method

This commit is contained in:
Alex
2025-08-06 20:52:37 +03:00
parent 62fbb6cf3b
commit 68da594f89
4 changed files with 27 additions and 7 deletions
@@ -29,4 +29,23 @@ final class OpenAppButtonTest extends TestCase
$this->assertSame($expectedArray, $resultArray);
}
#[Test]
public function fromArrayHydratesCorrectly(): void
{
$data = [
'type' => 'open_app',
'text' => 'Launch',
'web_app' => 'SomeApp',
'contact_id' => 456,
];
$button = OpenAppButton::fromArray($data);
$this->assertInstanceOf(OpenAppButton::class, $button);
$this->assertSame(InlineButtonType::OpenApp, $button->type);
$this->assertSame('Launch', $button->text);
$this->assertSame('SomeApp', $button->webApp);
$this->assertSame(456, $button->contactId);
}
}