Skip to content

Commit

Permalink
Merge pull request #69 from CrazyTapok-bit/feature/new-property
Browse files Browse the repository at this point in the history
Add new property (#68)
  • Loading branch information
CrazyTapok-bit authored Nov 21, 2023
2 parents d613c1a + d33bbd7 commit 946355b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Entities/InitData/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ final class User extends Make
* Optional. Only returned for web applications launched from a direct link.
*/
public ?bool $allowsWriteToPm = null;

/**
* Optional. True, if this user added the bot to the attachment menu.
*/
public ?bool $addedToAttachmentMenu = null;
}
3 changes: 3 additions & 0 deletions tests/Entities/InitData/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function testMake(): array
$this->assertNull($user->isPremium);
$this->assertNull($user->photoUrl);
$this->assertNull($user->allowsWriteToPm);
$this->assertNull($user->addedToAttachmentMenu);
$this->assertInstanceOf(Arrayable::class, $user);

return $data;
Expand All @@ -46,6 +47,7 @@ public function testMakeFull(array $data): void
$data['language_code'] = 'uk';
$data['is_premium'] = false;
$data['allows_write_to_pm'] = true;
$data['added_to_attachment_menu'] = true;
$data['photo_url'] = 'https://t.me/i/userpic/320/7gMg9ZfoSzMQcLwYiEj4rLAofXXn0wOBV9HXGb6c1T0.jpg';

$user = new User($data);
Expand All @@ -57,6 +59,7 @@ public function testMakeFull(array $data): void
$this->assertFalse($user->isPremium);
$this->assertEquals($data['photo_url'], $user->photoUrl);
$this->assertTrue($user->allowsWriteToPm);
$this->assertTrue($user->addedToAttachmentMenu);
$this->assertInstanceOf(Arrayable::class, $user);
}
}

0 comments on commit 946355b

Please sign in to comment.