forked from TelegramBot/Api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStickerTest.php
More file actions
146 lines (130 loc) · 3.94 KB
/
StickerTest.php
File metadata and controls
146 lines (130 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
namespace TelegramBot\Api\Test;
use TelegramBot\Api\Types\PhotoSize;
use TelegramBot\Api\Types\Sticker;
class StickerTest extends \PHPUnit_Framework_TestCase {
public function testSetFileId()
{
$sticker = new Sticker();
$sticker->setFileId('testfileId');
$this->assertAttributeEquals('testfileId', 'fileId', $sticker);
}
public function testGetFileId()
{
$sticker = new Sticker();
$sticker->setFileId('testfileId');
$this->assertEquals('testfileId', $sticker->getFileId());
}
public function testSetWidth()
{
$sticker = new Sticker();
$sticker->setWidth(1);
$this->assertAttributeEquals(1, 'width', $sticker);
}
public function testGetWidth()
{
$sticker = new Sticker();
$sticker->setWidth(2);
$this->assertEquals(2, $sticker->getWidth());
}
public function testSetHeight()
{
$sticker = new Sticker();
$sticker->setHeight(3);
$this->assertAttributeEquals(3, 'height', $sticker);
}
public function testGetHeight()
{
$sticker = new Sticker();
$sticker->setHeight(4);
$this->assertEquals(4, $sticker->getHeight());
}
public function testSetFileSize()
{
$sticker = new Sticker();
$sticker->setFileSize(5);
$this->assertAttributeEquals(5, 'fileSize', $sticker);
}
public function testGetFileSize()
{
$sticker = new Sticker();
$sticker->setFileSize(6);
$this->assertEquals(6, $sticker->getFileSize());
}
public function testSetThumb()
{
$sticker = new Sticker();
$thumb = PhotoSize::fromResponse(array(
"file_id" => 'testFileId1',
'width' => 1,
'height' => 2,
'file_size' => 3
));
$sticker->setThumb($thumb);
$this->assertAttributeEquals($thumb, 'thumb', $sticker);
}
public function testGetThumb()
{
$sticker = new Sticker();
$thumb = PhotoSize::fromResponse(array(
"file_id" => 'testFileId1',
'width' => 1,
'height' => 2,
'file_size' => 3
));
$sticker->setThumb($thumb);
$this->assertEquals($thumb, $sticker->getThumb());
$this->assertInstanceOf('\TelegramBot\Api\Types\PhotoSize', $sticker->getThumb());
}
public function testFromResponse()
{
$sticker = Sticker::fromResponse(array(
"file_id" => 'testFileId1',
'width' => 1,
'height' => 2,
'file_size' => 3,
'thumb' => array(
"file_id" => 'testFileId1',
'width' => 1,
'height' => 2,
'file_size' => 3
)
));
$thumb = PhotoSize::fromResponse(array(
"file_id" => 'testFileId1',
'width' => 1,
'height' => 2,
'file_size' => 3
));
$this->assertInstanceOf('\TelegramBot\Api\Types\Sticker', $sticker);
$this->assertAttributeEquals('testFileId1', 'fileId', $sticker);
$this->assertAttributeEquals(1, 'width', $sticker);
$this->assertAttributeEquals(2, 'height', $sticker);
$this->assertAttributeEquals(3, 'fileSize', $sticker);
$this->assertAttributeEquals($thumb, 'thumb', $sticker);
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetFileSizeException()
{
$item = new Sticker();
$item->setFileSize('s');
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetHeightException()
{
$item = new Sticker();
$item->setHeight('s');
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetWidthException()
{
$item = new Sticker();
$item->setWidth('s');
}
}