66
77class UpdateTest extends \PHPUnit_Framework_TestCase
88{
9- public function testInlineQuery ()
10- {
11- $ updateObject = new Update ([
9+ private $ dataProvider = [
10+ 'inlineQuery ' => [
1211 'update_id ' => 123498765 ,
1312 'inline_query ' => [
1413 'id ' => 12345678901234567 ,
@@ -21,12 +20,43 @@ public function testInlineQuery()
2120 'query ' => 'let \'s ask something! ' ,
2221 'offset ' => '' ,
2322 ],
24- ]);
23+ ],
24+ 'inlineResult ' => [
25+ 'update_id ' => 123451234 ,
26+ 'chosen_inline_result ' => [
27+ 'from ' => [
28+ 'id ' => 12341234 ,
29+ 'first_name ' => 'Camilo ' ,
30+ 'last_name ' => 'Sperberg ' ,
31+ 'username ' => 'unreal4u ' ,
32+ ],
33+ 'query ' => 'what is love? ' ,
34+ 'result_id ' => '2368eee6cf37da22bc64034c87c3b0b8 ' ,
35+ ],
36+ ],
37+ ];
38+
39+ public function testInlineQuery ()
40+ {
41+ $ updateObject = new Update ($ this ->dataProvider ['inlineQuery ' ]);
2542
2643 $ this ->assertInstanceOf ('unreal4u \\Telegram \\Types \\Update ' , $ updateObject );
2744 $ this ->assertInstanceOf ('unreal4u \\Telegram \\Types \\InlineQuery ' , $ updateObject ->inline_query );
2845 $ this ->assertInstanceOf ('unreal4u \\Telegram \\Types \\User ' , $ updateObject ->inline_query ->from );
2946 $ this ->assertNull ($ updateObject ->message );
3047 $ this ->assertNull ($ updateObject ->chosen_inline_result );
3148 }
49+
50+ public function testChosenInlineResult ()
51+ {
52+ $ updateObject = new Update ($ this ->dataProvider ['inlineResult ' ]);
53+
54+ $ this ->assertInstanceOf ('unreal4u \\Telegram \\Types \\Update ' , $ updateObject );
55+ $ this ->assertInstanceOf ('unreal4u \\Telegram \\Types \\ChosenInlineResult ' , $ updateObject ->chosen_inline_result );
56+ $ this ->assertInstanceOf ('unreal4u \\Telegram \\Types \\User ' , $ updateObject ->chosen_inline_result ->from );
57+ $ this ->assertNull ($ updateObject ->message );
58+ $ this ->assertNull ($ updateObject ->inline_query );
59+ $ this ->assertNotEmpty ($ updateObject ->chosen_inline_result ->query );
60+ $ this ->assertNotEmpty ($ updateObject ->chosen_inline_result ->result_id );
61+ }
3262}
0 commit comments