From ee0ce704100bd2f267a2c25545b046392ed1947c Mon Sep 17 00:00:00 2001 From: eldarQa Date: Tue, 12 Jan 2021 17:23:59 +0100 Subject: [PATCH 1/2] Update types --- src/Types/Chat.php | 137 ++++++++++++++++++--- src/Types/ChatLocation.php | 72 +++++++++++ src/Types/ChatPermissions.php | 220 ++++++++++++++++++++++++++++++++++ src/Types/Contact.php | 28 ++++- src/Types/Dice.php | 31 ++++- src/Types/Location.php | 106 +++++++++++++++- tests/ChatLocationTest.php | 45 +++++++ tests/ChatTest.php | 29 ++--- tests/ContactTest.php | 14 +++ tests/LocationTest.php | 81 ++++++++++++- 10 files changed, 725 insertions(+), 38 deletions(-) create mode 100644 src/Types/ChatLocation.php create mode 100644 src/Types/ChatPermissions.php create mode 100644 tests/ChatLocationTest.php diff --git a/src/Types/Chat.php b/src/Types/Chat.php index f4db50cf..3e6ce001 100644 --- a/src/Types/Chat.php +++ b/src/Types/Chat.php @@ -27,13 +27,17 @@ class Chat extends BaseType implements TypeInterface 'username' => true, 'first_name' => true, 'last_name' => true, - 'all_members_are_administrators' => true, 'photo' => ChatPhoto::class, + 'bio' => true, 'description' => true, 'invite_link' => true, 'pinned_message' => Message::class, + 'permissions' => ChatPermissions::class, + 'slow_mode_delay' => true, 'sticker_set_name' => true, - 'can_set_sticker_set' => true + 'can_set_sticker_set' => true, + 'linked_chat_id' => true, + 'location' => ChatLocation::class ]; /** @@ -78,8 +82,6 @@ class Chat extends BaseType implements TypeInterface */ protected $lastName; - protected $allMembersAreAdministrators; - /** * Optional. Chat photo. Returned only in getChat. * @@ -87,6 +89,13 @@ class Chat extends BaseType implements TypeInterface */ protected $photo; + /** + * Optional. Bio of the other party in a private chat. Returned only in getChat + * + * @var string + */ + protected $bio; + /** * Optional. Description, for supergroups and channel chats. Returned only in getChat. * @@ -108,6 +117,21 @@ class Chat extends BaseType implements TypeInterface */ protected $pinnedMessage; + /** + * Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. + * + * @var ChatPermissions + */ + protected $permissions; + + /** + * Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged + * user. Returned only in getChat. + * + * @var int + */ + protected $slowModeDelay; + /** * Optional. For supergroups, name of group sticker set. Returned only in getChat. * @@ -122,6 +146,23 @@ class Chat extends BaseType implements TypeInterface */ protected $canSetStickerSet; + /** + * Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice + * versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming + * languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 + * bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat. + * + * @var int + */ + protected $linkedChatId; + + /** + * Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. + * + * @var ChatLocation + */ + protected $location; + /** * @return int|string */ @@ -225,35 +266,35 @@ public function setLastName($lastName) } /** - * @return mixed + * @return ChatPhoto */ - public function getAllMembersAreAdministrators() + public function getPhoto() { - return $this->allMembersAreAdministrators; + return $this->photo; } /** - * @param mixed $allMembersAreAdministrators + * @param ChatPhoto $photo */ - public function setAllMembersAreAdministrators($allMembersAreAdministrators) + public function setPhoto($photo) { - $this->allMembersAreAdministrators = $allMembersAreAdministrators; + $this->photo = $photo; } /** - * @return ChatPhoto + * @return string */ - public function getPhoto() + public function getBio() { - return $this->photo; + return $this->bio; } /** - * @param ChatPhoto $photo + * @param string $bio */ - public function setPhoto($photo) + public function setBio($bio) { - $this->photo = $photo; + $this->bio = $bio; } /** @@ -304,6 +345,38 @@ public function setPinnedMessage($pinnedMessage) $this->pinnedMessage = $pinnedMessage; } + /** + * @return ChatPermissions + */ + public function getPermissions() + { + return $this->permissions; + } + + /** + * @param ChatPermissions $permissions + */ + public function setPermissions($permissions) + { + $this->permissions = $permissions; + } + + /** + * @return int + */ + public function getSlowModeDelay() + { + return $this->slowModeDelay; + } + + /** + * @param int $slowModeDelay + */ + public function setSlowModeDelay($slowModeDelay) + { + $this->slowModeDelay = $slowModeDelay; + } + /** * @return string */ @@ -335,4 +408,36 @@ public function setCanSetStickerSet($canSetStickerSet) { $this->canSetStickerSet = $canSetStickerSet; } + + /** + * @return int + */ + public function getLinkedChatId() + { + return $this->linkedChatId; + } + + /** + * @param int $linkedChatId + */ + public function setLinkedChatId($linkedChatId) + { + $this->linkedChatId = $linkedChatId; + } + + /** + * @return ChatLocation + */ + public function getLocation() + { + return $this->location; + } + + /** + * @param ChatLocation $location + */ + public function setLocation($location) + { + $this->location = $location; + } } diff --git a/src/Types/ChatLocation.php b/src/Types/ChatLocation.php new file mode 100644 index 00000000..2330b982 --- /dev/null +++ b/src/Types/ChatLocation.php @@ -0,0 +1,72 @@ + Location::class, + 'address' => true, + ]; + + /** + * The location to which the supergroup is connected. Can't be a live location. + * + * @var Location + */ + protected $location; + + /** + * Location address; 1-64 characters, as defined by the chat owner + * + * @var string + */ + protected $address; + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } + + /** + * @param Location $location + */ + public function setLocation($location) + { + $this->location = $location; + } + + /** + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * @param string $address + */ + public function setAddress($address) + { + $this->address = $address; + } +} diff --git a/src/Types/ChatPermissions.php b/src/Types/ChatPermissions.php new file mode 100644 index 00000000..99bb6787 --- /dev/null +++ b/src/Types/ChatPermissions.php @@ -0,0 +1,220 @@ + true, + 'can_send_media_messages' => true, + 'can_send_polls' => true, + 'can_send_other_messages' => true, + 'can_add_web_page_previews' => true, + 'can_change_info' => true, + 'can_invite_users' => true, + 'can_pin_messages' => true, + ]; + + /** + * Optional. True, if the user is allowed to send text messages, contacts, locations and venues + * + * @var bool + */ + protected $canSendMessages; + + /** + * Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, + * implies can_send_messages + * + * @var bool + */ + protected $canSendMediaMessages; + + /** + * Optional. True, if the user is allowed to send polls, implies can_send_messages + * + * @var bool + */ + protected $canSendPolls; + + /** + * Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies + * can_send_media_messages + * + * @var bool + */ + protected $canSendOtherMessages; + + /** + * Optional. True, if the user is allowed to add web page previews to their messages, implies + * can_send_media_messages + * + * @var bool + */ + protected $canAddWebPagePreviews; + + /** + * Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public + * supergroups + * + * @var bool + */ + protected $canChangeInfo; + + /** + * Optional. True, if the user is allowed to invite new users to the chat + * + * @var bool + */ + protected $canInviteUsers; + + /** + * Optional. True, if the user is allowed to pin messages. Ignored in public supergroups + * + * @var bool + */ + protected $canPinMessages; + + /** + * @return bool + */ + public function isCanSendMessages() + { + return $this->canSendMessages; + } + + /** + * @param bool $canSendMessages + */ + public function setCanSendMessages($canSendMessages) + { + $this->canSendMessages = $canSendMessages; + } + + /** + * @return bool + */ + public function isCanSendMediaMessages() + { + return $this->canSendMediaMessages; + } + + /** + * @param bool $canSendMediaMessages + */ + public function setCanSendMediaMessages($canSendMediaMessages) + { + $this->canSendMediaMessages = $canSendMediaMessages; + } + + /** + * @return bool + */ + public function isCanSendPolls() + { + return $this->canSendPolls; + } + + /** + * @param bool $canSendPolls + */ + public function setCanSendPolls($canSendPolls) + { + $this->canSendPolls = $canSendPolls; + } + + /** + * @return bool + */ + public function isCanSendOtherMessages() + { + return $this->canSendOtherMessages; + } + + /** + * @param bool $canSendOtherMessages + */ + public function setCanSendOtherMessages($canSendOtherMessages) + { + $this->canSendOtherMessages = $canSendOtherMessages; + } + + /** + * @return bool + */ + public function isCanAddWebPagePreviews() + { + return $this->canAddWebPagePreviews; + } + + /** + * @param bool $canAddWebPagePreviews + */ + public function setCanAddWebPagePreviews($canAddWebPagePreviews) + { + $this->canAddWebPagePreviews = $canAddWebPagePreviews; + } + + /** + * @return bool + */ + public function isCanChangeInfo() + { + return $this->canChangeInfo; + } + + /** + * @param bool $canChangeInfo + */ + public function setCanChangeInfo($canChangeInfo) + { + $this->canChangeInfo = $canChangeInfo; + } + + /** + * @return bool + */ + public function isCanInviteUsers() + { + return $this->canInviteUsers; + } + + /** + * @param bool $canInviteUsers + */ + public function setCanInviteUsers($canInviteUsers) + { + $this->canInviteUsers = $canInviteUsers; + } + + /** + * @return bool + */ + public function isCanPinMessages() + { + return $this->canPinMessages; + } + + /** + * @param bool $canPinMessages + */ + public function setCanPinMessages($canPinMessages) + { + $this->canPinMessages = $canPinMessages; + } +} diff --git a/src/Types/Contact.php b/src/Types/Contact.php index e9c5564a..884a255d 100644 --- a/src/Types/Contact.php +++ b/src/Types/Contact.php @@ -7,7 +7,7 @@ /** * Class Contact - * This object represents a sticker. + * This object represents a phone contact. * * @package TelegramBot\Api\Types */ @@ -29,7 +29,8 @@ class Contact extends BaseType implements TypeInterface 'phone_number' => true, 'first_name' => true, 'last_name' => true, - 'user_id' => true + 'user_id' => true, + 'vcard' => true, ]; /** @@ -60,6 +61,13 @@ class Contact extends BaseType implements TypeInterface */ protected $userId; + /** + * Optional. Additional data about the contact in the form of a vCard + * + * @var string + */ + protected $vCard; + /** * @return string */ @@ -123,4 +131,20 @@ public function setUserId($userId) { $this->userId = $userId; } + + /** + * @return string + */ + public function getVCard() + { + return $this->vCard; + } + + /** + * @param string $vCard + */ + public function setVCard($vCard) + { + $this->vCard = $vCard; + } } diff --git a/src/Types/Dice.php b/src/Types/Dice.php index 5a715027..ee2e089c 100644 --- a/src/Types/Dice.php +++ b/src/Types/Dice.php @@ -7,8 +7,7 @@ /** * Class Dice - * This object represents a dice with random value from 1 to 6. (Yes, we're aware of the β€œproper” singular of die. - * But it's awkward, and we decided to help it change. One dice at a time!) + * This object represents an animated emoji that displays a random value. */ class Dice extends BaseType implements TypeInterface { @@ -17,7 +16,7 @@ class Dice extends BaseType implements TypeInterface * * @var array */ - static protected $requiredParams = ['value']; + static protected $requiredParams = ['emoji', 'value']; /** * {@inheritdoc} @@ -25,16 +24,40 @@ class Dice extends BaseType implements TypeInterface * @var array */ static protected $map = [ + 'emoji' => true, 'value' => true ]; /** - * Value of the dice, 1-6 + * Emoji on which the dice throw animation is based + * + * @var string + */ + protected $emoji; + + /** + * Value of the dice, 1-6 for β€œπŸŽ²β€ and β€œπŸŽ―β€ base emoji, 1-5 for β€œπŸ€β€ and β€œβš½β€ base emoji, 1-64 for β€œπŸŽ°β€ base emoji * * @var int */ protected $value; + /** + * @return string + */ + public function getEmoji() + { + return $this->emoji; + } + + /** + * @param string $emoji + */ + public function setEmoji($emoji) + { + $this->emoji = $emoji; + } + /** * @return int */ diff --git a/src/Types/Location.php b/src/Types/Location.php index 5c449c96..917009bc 100644 --- a/src/Types/Location.php +++ b/src/Types/Location.php @@ -28,7 +28,11 @@ class Location extends BaseType implements TypeInterface */ static protected $map = [ 'latitude' => true, - 'longitude' => true + 'longitude' => true, + 'horizontal_accuracy' => true, + 'live_period' => true, + 'heading' => true, + 'proximity_alert_radius' => true, ]; /** @@ -45,6 +49,36 @@ class Location extends BaseType implements TypeInterface */ protected $latitude; + /** + * Optional. The radius of uncertainty for the location, measured in meters; 0-1500 + * + * @var float + */ + protected $horizontalAccuracy; + + /** + * Optional. Time relative to the message sending date, during which the location can be updated, in seconds. For + * active live locations only. + * + * @var int + */ + protected $livePeriod; + + /** + * Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only. + * + * @var int + */ + protected $heading; + + /** + * Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live + * locations only. + * + * @var int + */ + protected $proximityAlertRadius; + /** * @return float */ @@ -88,4 +122,74 @@ public function setLongitude($longitude) throw new InvalidArgumentException(); } } + + /** + * @return float + */ + public function getHorizontalAccuracy() + { + return $this->horizontalAccuracy; + } + + /** + * @param float $horizontalAccuracy + * + * @throws InvalidArgumentException + */ + public function setHorizontalAccuracy($horizontalAccuracy) + { + if (is_float($horizontalAccuracy)) { + $this->horizontalAccuracy = $horizontalAccuracy; + } else { + throw new InvalidArgumentException(); + } + } + + /** + * @return int + */ + public function getLivePeriod() + { + return $this->livePeriod; + } + + /** + * @param int $livePeriod + */ + public function setLivePeriod($livePeriod) + { + $this->livePeriod = $livePeriod; + } + + /** + * @return int + */ + public function getHeading() + { + return $this->heading; + } + + /** + * @param int $heading + */ + public function setHeading($heading) + { + $this->heading = $heading; + } + + /** + * @return int + */ + public function getProximityAlertRadius() + { + return $this->proximityAlertRadius; + } + + /** + * @param int $proximityAlertRadius + */ + public function setProximityAlertRadius($proximityAlertRadius) + { + $this->proximityAlertRadius = $proximityAlertRadius; + } } diff --git a/tests/ChatLocationTest.php b/tests/ChatLocationTest.php new file mode 100644 index 00000000..bdef1251 --- /dev/null +++ b/tests/ChatLocationTest.php @@ -0,0 +1,45 @@ +setLatitude(55.585827); + $location->setLongitude(37.675309); + + $chatLocation->setLocation($location); + + $this->assertEquals($location, $chatLocation->getLocation()); + } + + public function testGetPollId() + { + $chatLocation = new ChatLocation(); + $chatLocation->setAddress('Wall St. 123'); + + $this->assertEquals('Wall St. 123', $chatLocation->getAddress()); + } + + public function testFromResponse() + { + $chatLocation = ChatLocation::fromResponse( + [ + 'location' => [ + 'latitdude' => 55.585827, + 'longtitude' => 37.675309, + ], + 'address' => 'Wall St. 123' + ] + ); + $this->assertInstanceOf('\TelegramBot\Api\Types\ChatLocation', $chatLocation); + $this->assertAttributeEquals('Wall St. 123', 'address', $chatLocation); + } +} diff --git a/tests/ChatTest.php b/tests/ChatTest.php index 0dd1ae90..d274ef12 100644 --- a/tests/ChatTest.php +++ b/tests/ChatTest.php @@ -112,20 +112,6 @@ public function testGetLastName() $this->assertEquals('Gusev', $chat->getLastName()); } - public function testSetAllMembersAreAdministrators() - { - $chat = new Chat(); - $chat->setAllMembersAreAdministrators(true); - $this->assertAttributeEquals(true, 'allMembersAreAdministrators', $chat); - } - - public function testGetAllMembersAreAdministrators() - { - $chat = new Chat(); - $chat->setAllMembersAreAdministrators(true); - $this->assertEquals(true, $chat->getAllMembersAreAdministrators()); - } - public function testSetPhoto() { $chat = new Chat(); @@ -148,6 +134,20 @@ public function testGetPhoto() $this->assertEquals($photo, $chat->getPhoto()); } + public function testSetBio() + { + $chat = new Chat(); + $chat->setBio('PHP Telegram Bot API'); + $this->assertAttributeEquals('PHP Telegram Bot API', 'bio', $chat); + } + + public function testGetBio() + { + $chat = new Chat(); + $chat->setBio('PHP Telegram Bot API'); + $this->assertEquals('PHP Telegram Bot API', $chat); + } + public function testSetDescriptions() { $chat = new Chat(); @@ -176,6 +176,7 @@ public function testFromResponseUser() $this->assertEquals('Ilya', $item->getFirstName()); $this->assertEquals('Gusev', $item->getLastName()); $this->assertEquals('iGusev', $item->getUsername()); + $this->assertEquals('PHP Telegram Bot API', $item->getBio()); } /** diff --git a/tests/ContactTest.php b/tests/ContactTest.php index 7aea3aec..4a1211f3 100644 --- a/tests/ContactTest.php +++ b/tests/ContactTest.php @@ -62,6 +62,20 @@ public function testGetUserId() $this->assertEquals('iGusev', $contact->getUserId()); } + public function testSetVCard() + { + $contact = new Contact(); + $contact->setVCard('testVCard'); + $this->assertAttributeEquals('testVCard', 'vCard', $contact); + } + + public function testGetVCard() + { + $contact = new Contact(); + $contact->setVCard('testVCard'); + $this->assertEquals('testVCard', $contact->getVCard()); + } + public function testFromResponse() { $contact = Contact::fromResponse(array( diff --git a/tests/LocationTest.php b/tests/LocationTest.php index 136e40e4..758d9f30 100644 --- a/tests/LocationTest.php +++ b/tests/LocationTest.php @@ -35,12 +35,90 @@ public function testGetLongtitude() $this->assertEquals(37.675309, $location->getLongitude()); } + public function testSetHorizontalAccuracy() + { + $location = new Location(); + $location->setHorizontalAccuracy(20.5); + $this->assertAttributeEquals(20.5, 'horizontal_accuracy', $location); + } + + public function testGetHorizontalAccuracy() + { + $location = new Location(); + $location->setHorizontalAccuracy(20.5); + $this->assertEquals(20.5, $location->getHorizontalAccuracy()); + } + + public function testSetLivePeriod() + { + $location = new Location(); + $location->setLivePeriod(300); + $this->assertAttributeEquals(300, 'live_period', $location); + } + + public function testGetLivePeriod() + { + $location = new Location(); + $location->setLivePeriod(300); + $this->assertEquals(300, $location->getLivePeriod()); + } + + public function testSetHeading() + { + $location = new Location(); + $location->setHeading(100); + $this->assertAttributeEquals(100, 'heading', $location); + } + + public function testGetHeading() + { + $location = new Location(); + $location->setHeading(100); + $this->assertEquals(100, $location->getHeading()); + } + + public function testSetProximityAlertRadius() + { + $location = new Location(); + $location->setProximityAlertRadius(15); + $this->assertAttributeEquals(15, 'proximity_alert_radius', $location); + } + + public function testGetProximityAlertRadius() + { + $location = new Location(); + $location->setProximityAlertRadius(100); + $this->assertEquals(15, $location->getProximityAlertRadius()); + } + public function testFromResponse() { - $location = Location::fromResponse(array("latitude" => 55.585827, 'longitude' => 37.675309)); + $location = Location::fromResponse( + array( + "latitude" => 55.585827, + 'longitude' => 37.675309, + 'horizontal_accuracy' => 20.5, + 'live_period' => 300, + 'heading' => 100, + 'proximity_alert_radius' => 15 + ) + ); $this->assertInstanceOf('\TelegramBot\Api\Types\Location', $location); $this->assertAttributeEquals(55.585827, 'latitude', $location); $this->assertAttributeEquals(37.675309, 'longitude', $location); + $this->assertAttributeEquals(20.5, 'horizontal_accuracy', $location); + $this->assertAttributeEquals(300, 'live_period', $location); + $this->assertAttributeEquals(100, 'heading', $location); + $this->assertAttributeEquals(15, 'proximity_alert_radius', $location); + } + + /** + * @expectedException \TelegramBot\Api\InvalidArgumentException + */ + public function testSetHorizontalAccuracyException() + { + $item = new Location(); + $item->setHorizontalAccuracy('s'); } /** @@ -51,6 +129,7 @@ public function testSetLatitudeException() $item = new Location(); $item->setLatitude('s'); } + /** * @expectedException \TelegramBot\Api\InvalidArgumentException */ From fbcf948f8c53f140876232e713d996b52f709dc2 Mon Sep 17 00:00:00 2001 From: eldarQa Date: Tue, 12 Jan 2021 18:00:20 +0100 Subject: [PATCH 2/2] fix tests --- tests/ChatLocationTest.php | 6 +++--- tests/ChatTest.php | 6 ++++-- tests/LocationTest.php | 15 +++++++-------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/ChatLocationTest.php b/tests/ChatLocationTest.php index bdef1251..a9693311 100644 --- a/tests/ChatLocationTest.php +++ b/tests/ChatLocationTest.php @@ -20,7 +20,7 @@ public function testGetLocation() $this->assertEquals($location, $chatLocation->getLocation()); } - public function testGetPollId() + public function testGetAddress() { $chatLocation = new ChatLocation(); $chatLocation->setAddress('Wall St. 123'); @@ -33,8 +33,8 @@ public function testFromResponse() $chatLocation = ChatLocation::fromResponse( [ 'location' => [ - 'latitdude' => 55.585827, - 'longtitude' => 37.675309, + 'latitude' => 55.585827, + 'longitude' => 37.675309, ], 'address' => 'Wall St. 123' ] diff --git a/tests/ChatTest.php b/tests/ChatTest.php index d274ef12..b0b463ea 100644 --- a/tests/ChatTest.php +++ b/tests/ChatTest.php @@ -145,7 +145,7 @@ public function testGetBio() { $chat = new Chat(); $chat->setBio('PHP Telegram Bot API'); - $this->assertEquals('PHP Telegram Bot API', $chat); + $this->assertEquals('PHP Telegram Bot API', $chat->getBio()); } public function testSetDescriptions() @@ -169,8 +169,10 @@ public function testFromResponseUser() 'last_name' => 'Gusev', 'id' => 123456, 'username' => 'iGusev', - 'type' => 'private' + 'type' => 'private', + 'bio' => 'PHP Telegram Bot API' )); + $this->assertInstanceOf('\TelegramBot\Api\Types\Chat', $item); $this->assertEquals(123456, $item->getId()); $this->assertEquals('Ilya', $item->getFirstName()); diff --git a/tests/LocationTest.php b/tests/LocationTest.php index 758d9f30..322c5639 100644 --- a/tests/LocationTest.php +++ b/tests/LocationTest.php @@ -2,7 +2,6 @@ namespace TelegramBot\Api\Test; - use TelegramBot\Api\Types\Location; class LocationTest extends \PHPUnit_Framework_TestCase @@ -39,7 +38,7 @@ public function testSetHorizontalAccuracy() { $location = new Location(); $location->setHorizontalAccuracy(20.5); - $this->assertAttributeEquals(20.5, 'horizontal_accuracy', $location); + $this->assertAttributeEquals(20.5, 'horizontalAccuracy', $location); } public function testGetHorizontalAccuracy() @@ -53,7 +52,7 @@ public function testSetLivePeriod() { $location = new Location(); $location->setLivePeriod(300); - $this->assertAttributeEquals(300, 'live_period', $location); + $this->assertAttributeEquals(300, 'livePeriod', $location); } public function testGetLivePeriod() @@ -81,14 +80,14 @@ public function testSetProximityAlertRadius() { $location = new Location(); $location->setProximityAlertRadius(15); - $this->assertAttributeEquals(15, 'proximity_alert_radius', $location); + $this->assertAttributeEquals(15, 'proximityAlertRadius', $location); } public function testGetProximityAlertRadius() { $location = new Location(); $location->setProximityAlertRadius(100); - $this->assertEquals(15, $location->getProximityAlertRadius()); + $this->assertEquals(100, $location->getProximityAlertRadius()); } public function testFromResponse() @@ -106,10 +105,10 @@ public function testFromResponse() $this->assertInstanceOf('\TelegramBot\Api\Types\Location', $location); $this->assertAttributeEquals(55.585827, 'latitude', $location); $this->assertAttributeEquals(37.675309, 'longitude', $location); - $this->assertAttributeEquals(20.5, 'horizontal_accuracy', $location); - $this->assertAttributeEquals(300, 'live_period', $location); + $this->assertAttributeEquals(20.5, 'horizontalAccuracy', $location); + $this->assertAttributeEquals(300, 'livePeriod', $location); $this->assertAttributeEquals(100, 'heading', $location); - $this->assertAttributeEquals(15, 'proximity_alert_radius', $location); + $this->assertAttributeEquals(15, 'proximityAlertRadius', $location); } /**