Skip to content

Commit

Permalink
Fix for exceptions on 32-bit systems
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeAx committed May 7, 2016
1 parent 0f9e90d commit 8efe22c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Types/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getId()
*/
public function setId($id)
{
if (is_integer($id)) {
if (is_integer($id) || is_float($id)) {
$this->id = $id;
} else {
throw new InvalidArgumentException();
Expand Down
2 changes: 1 addition & 1 deletion src/Types/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ public function getMessageId()
*/
public function setMessageId($messageId)
{
if (is_integer($messageId)) {
if (is_integer($messageId) || is_float($messageId)) {
$this->messageId = $messageId;
} else {
throw new InvalidArgumentException();
Expand Down
2 changes: 1 addition & 1 deletion src/Types/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getId()
*/
public function setId($id)
{
if (is_integer($id)) {
if (is_integer($id) || is_float($id)) {
$this->id = $id;
} else {
throw new InvalidArgumentException();
Expand Down
7 changes: 7 additions & 0 deletions tests/ChatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public function testSetId()
$this->assertAttributeEquals(1, 'id', $chat);
}

public function testSet64bitId()
{
$chat = new Chat();
$chat->setId(2147483648);
$this->assertAttributeEquals(2147483648, 'id', $chat);
}

public function testGetId()
{
$chat = new Chat();
Expand Down
7 changes: 7 additions & 0 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public function testSetMessageId()
$this->assertAttributeEquals(1, 'messageId', $item);
}

public function testSet64bitMessageId()
{
$item = new Message();
$item->setMessageId(2147483648);
$this->assertAttributeEquals(2147483648, 'messageId', $item);
}

public function testGetMessageId()
{
$item = new Message();
Expand Down
7 changes: 7 additions & 0 deletions tests/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public function testSetDuration()
$this->assertAttributeEquals(1, 'id', $item);
}

public function testSet64bitId()
{
$item = new User();
$item->setId(2147483648);
$this->assertAttributeEquals(2147483648, 'id', $item);
}

public function testGetDuration()
{
$item = new User();
Expand Down

0 comments on commit 8efe22c

Please sign in to comment.