5
5
namespace TgBotApi \BotApiBase \Tests \Method ;
6
6
7
7
use TgBotApi \BotApiBase \BotApiComplete ;
8
- use TgBotApi \BotApiBase \Method \SendContactMethod ;
9
8
use TgBotApi \BotApiBase \Method \SendDiceMethod ;
10
9
use TgBotApi \BotApiBase \Tests \Method \Traits \InlineKeyboardMarkupTrait ;
11
10
@@ -14,39 +13,56 @@ class SendDiceMethodTest extends MethodTestCase
14
13
use InlineKeyboardMarkupTrait;
15
14
16
15
/**
17
- * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
16
+ * @dataProvider dataProvider
17
+ *
18
18
* @throws \TgBotApi\BotApiBase\Exception\ResponseException
19
19
*/
20
- public function testEncode ()
20
+ public function testEncode (BotApiComplete $ bot , SendDiceMethod $ method ): void
21
21
{
22
- $ this ->getApi ()->sendDice ($ this ->getMethod ());
23
- $ this ->getApi ()->send ($ this ->getMethod ());
22
+ $ bot ->sendDice ($ method );
24
23
}
25
24
26
- private function getApi (): BotApiComplete
25
+ /**
26
+ * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
27
+ *
28
+ * @return array[]
29
+ */
30
+ public function dataProvider (): array
31
+ {
32
+ return [
33
+ [
34
+ $ this ->getApi (SendDiceMethod::EMOJI_DICE ),
35
+ SendDiceMethod::createWithDice (
36
+ 'chat_id ' ,
37
+ [
38
+ 'disableNotification ' => true ,
39
+ 'replyToMessageId ' => 1 ,
40
+ 'replyMarkup ' => $ this ->buildInlineMarkupObject (),
41
+ ]
42
+ ),
43
+ ],
44
+ [
45
+ $ this ->getApi (SendDiceMethod::EMOJI_DARTS ),
46
+ SendDiceMethod::createWithDarts (
47
+ 'chat_id ' ,
48
+ [
49
+ 'disableNotification ' => true ,
50
+ 'replyToMessageId ' => 1 ,
51
+ 'replyMarkup ' => $ this ->buildInlineMarkupObject (),
52
+ ]
53
+ ),
54
+ ],
55
+ ];
56
+ }
57
+
58
+ private function getApi (string $ emoji ): BotApiComplete
27
59
{
28
60
return $ this ->getBot ('sendDice ' , [
29
61
'chat_id ' => 'chat_id ' ,
30
62
'disable_notification ' => true ,
31
63
'reply_to_message_id ' => 1 ,
64
+ 'emoji ' => $ emoji ,
32
65
'reply_markup ' => $ this ->buildInlineMarkupArray (),
33
66
], [], ['reply_markup ' ]);
34
67
}
35
-
36
- /**
37
- * @throws \TgBotApi\BotApiBase\Exception\BadArgumentException
38
- *
39
- * @return SendContactMethod
40
- */
41
- private function getMethod (): SendDiceMethod
42
- {
43
- return SendDiceMethod::create (
44
- 'chat_id ' ,
45
- [
46
- 'disableNotification ' => true ,
47
- 'replyToMessageId ' => 1 ,
48
- 'replyMarkup ' => $ this ->buildInlineMarkupObject (),
49
- ]
50
- );
51
- }
52
68
}
0 commit comments