Skip to content

Commit 804ee2a

Browse files
author
eldarQa
committed
Update tests
1 parent bbc0f16 commit 804ee2a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/MessageTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace TelegramBot\Api\Test;
44

55
use TelegramBot\Api\Types\Chat;
6+
use TelegramBot\Api\Types\Dice;
67
use TelegramBot\Api\Types\Document;
78
use TelegramBot\Api\Types\Location;
89
use TelegramBot\Api\Types\Audio;
@@ -304,6 +305,7 @@ public function testSetVoice()
304305
$item = new Message();
305306
$voice = Voice::fromResponse(array(
306307
'file_id' => 'testFileId1',
308+
'file_unique_id' => 'testUniqueFileId',
307309
'duration' => 1,
308310
'mime_type' => 'audio/mp3',
309311
'file_size' => 3
@@ -317,6 +319,7 @@ public function testGetVoice()
317319
$item = new Message();
318320
$voice = Voice::fromResponse(array(
319321
'file_id' => 'testFileId1',
322+
'file_unique_id' => 'testUniqueFileId',
320323
'duration' => 1,
321324
'mime_type' => 'audio/mp3',
322325
'file_size' => 3
@@ -369,6 +372,29 @@ public function testGetVideo()
369372
$this->assertInstanceOf('\TelegramBot\Api\Types\Video', $item->getVideo());
370373
}
371374

375+
public function testSetDice()
376+
{
377+
$item = new Message();
378+
$dice = Dice::fromResponse(array(
379+
'emoji' => '🎲',
380+
'value' => 3
381+
));
382+
$item->setDice($dice);
383+
$this->assertAttributeEquals($dice, 'dice', $item);
384+
}
385+
386+
public function testGetDice()
387+
{
388+
$item = new Message();
389+
$dice = Dice::fromResponse(array(
390+
'emoji' => '🎲',
391+
'value' => 3
392+
));
393+
$item->setDice($dice);
394+
$this->assertEquals($dice, $item->getDice());
395+
$this->assertInstanceOf('\TelegramBot\Api\Types\Dice', $item->getDice());
396+
}
397+
372398
public function testSetSticker()
373399
{
374400
$item = new Message();

tests/VoiceTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ public function testGetFileId()
1919
$this->assertEquals('testfileId', $item->getFileId());
2020
}
2121

22+
public function testSetUniqueFileId()
23+
{
24+
$item = new Voice();
25+
$item->setFileUniqueId('fileUniqueId');
26+
$this->assertAttributeEquals('fileUniqueId', 'fileUniqueId', $item);
27+
}
28+
29+
public function testGetUniqueFileId()
30+
{
31+
$item = new Voice();
32+
$item->setFileUniqueId('fileUniqueId');
33+
$this->assertEquals('fileUniqueId', $item->getFileUniqueId());
34+
}
35+
2236
public function testSetDuration()
2337
{
2438
$item = new Voice();
@@ -65,12 +79,14 @@ public function testFromResponse()
6579
{
6680
$item = Voice::fromResponse(array(
6781
'file_id' => 'testFileId1',
82+
'file_unique_id' => 'testFileUniqueId1',
6883
'duration' => 1,
6984
'mime_type' => 'audio/mp3',
7085
'file_size' => 3
7186
));
7287
$this->assertInstanceOf('\TelegramBot\Api\Types\Voice', $item);
7388
$this->assertAttributeEquals('testFileId1', 'fileId', $item);
89+
$this->assertAttributeEquals('testFileUniqueId1', 'fileUniqueId', $item);
7490
$this->assertAttributeEquals(1, 'duration', $item);
7591
$this->assertAttributeEquals('audio/mp3', 'mimeType', $item);
7692
$this->assertAttributeEquals(3, 'fileSize', $item);

0 commit comments

Comments
 (0)