-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: #465 add full reactions support as defined in api 7.0 * feat: #465 add Link Preview Customization support as defined in api 7.0 * feat: #465 add Multiple Message Actions support as defined in api 7.0 * feat: #465 add Chat Boost as defined in api 7.0 * feat: #465 add Giveaway as defined in api 7.0
- Loading branch information
1 parent
3b44cb2
commit ae151c2
Showing
20 changed files
with
1,242 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace TelegramBot\Api\Test\Types; | ||
|
||
use TelegramBot\Api\Types\Chat; | ||
use TelegramBot\Api\Types\ArrayOfChat; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ArrayOfChatTest extends TestCase | ||
{ | ||
public function testFromResponse() | ||
{ | ||
$items = ArrayOfChat::fromResponse([ | ||
[ | ||
'id' => 123456789, | ||
'type' => 'group', | ||
], | ||
[ | ||
'id' => 123456788, | ||
'type' => 'private', | ||
] | ||
]); | ||
|
||
$expected = [ | ||
Chat::fromResponse([ | ||
'id' => 123456789, | ||
'type' => 'group', | ||
]), | ||
Chat::fromResponse([ | ||
'id' => 123456788, | ||
'type' => 'private', | ||
]) | ||
]; | ||
|
||
foreach ($items as $key => $item) { | ||
$this->assertEquals($expected[$key], $item); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace TelegramBot\Api\Test\Types; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use TelegramBot\Api\Types\ReactionTypeEmoji; | ||
use TelegramBot\Api\Types\ArrayOfReactionType; | ||
use TelegramBot\Api\Types\ReactionTypeCustomEmoji; | ||
|
||
class ArrayOfReactionTypeTest extends TestCase | ||
{ | ||
public function testFromResponse() | ||
{ | ||
$items = ArrayOfReactionType::fromResponse([ | ||
[ | ||
'emoji' => '👍', | ||
'type' => 'emoji' | ||
], | ||
[ | ||
'custom_emoji_id' => 'custom_emoji_123', | ||
'type' => 'custom_emoji' | ||
] | ||
]); | ||
|
||
$expected = [ | ||
ReactionTypeEmoji::fromResponse([ | ||
'emoji' => '👍', | ||
'type' => 'emoji' | ||
]), | ||
ReactionTypeCustomEmoji::fromResponse([ | ||
'custom_emoji_id' => 'custom_emoji_123', | ||
'type' => 'custom_emoji' | ||
]) | ||
]; | ||
|
||
foreach ($items as $key => $item) { | ||
$this->assertEquals($expected[$key], $item); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace TelegramBot\Api\Test\Types; | ||
|
||
use TelegramBot\Api\Test\AbstractTypeTest; | ||
use TelegramBot\Api\Types\ChatBoostRemoved; | ||
|
||
class ChatBoostRemovedTest extends AbstractTypeTest | ||
{ | ||
protected static function getType() | ||
{ | ||
return ChatBoostRemoved::class; | ||
} | ||
|
||
public static function getMinResponse() | ||
{ | ||
return [ | ||
'chat' => ChatTest::getMinResponse(), | ||
'boost_id' => 1, | ||
'remove_date' => 1682343643, | ||
'source' => ChatBoostSourceTest::getMinResponse() | ||
]; | ||
} | ||
|
||
public static function getFullResponse() | ||
{ | ||
return [ | ||
'chat' => ChatTest::getMinResponse(), | ||
'boost_id' => 1, | ||
'remove_date' => 1682343643, | ||
'source' => ChatBoostSourceTest::getMinResponse() | ||
]; | ||
} | ||
|
||
protected function assertMinItem($item) | ||
{ | ||
$this->assertEquals(ChatTest::createMinInstance(), $item->getChat()); | ||
$this->assertEquals(1, $item->getBoostId()); | ||
$this->assertEquals(1682343643, $item->getRemoveDate()); | ||
$this->assertEquals(ChatBoostSourceTest::createMinInstance(), $item->getSource()); | ||
} | ||
|
||
protected function assertFullItem($item) | ||
{ | ||
$this->assertEquals(ChatTest::createMinInstance(), $item->getChat()); | ||
$this->assertEquals(1, $item->getBoostId()); | ||
$this->assertEquals(1682343643, $item->getRemoveDate()); | ||
$this->assertEquals(ChatBoostSourceTest::createMinInstance(), $item->getSource()); | ||
} | ||
} |
Oops, something went wrong.