forked from TelegramBot/Api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhotoSizeTest.php
More file actions
106 lines (92 loc) · 2.77 KB
/
PhotoSizeTest.php
File metadata and controls
106 lines (92 loc) · 2.77 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
<?php
namespace TelegramBot\Api\Test;
use TelegramBot\Api\Types\PhotoSize;
class PhotoSizeTest extends \PHPUnit_Framework_TestCase
{
public function testSetFileId()
{
$photoSize = new PhotoSize();
$photoSize->setFileId('testfileId');
$this->assertAttributeEquals('testfileId', 'fileId', $photoSize);
}
public function testGetFileId()
{
$photoSize = new PhotoSize();
$photoSize->setFileId('testfileId');
$this->assertEquals('testfileId', $photoSize->getFileId());
}
public function testSetWidth()
{
$photoSize = new PhotoSize();
$photoSize->setWidth(1);
$this->assertAttributeEquals(1, 'width', $photoSize);
}
public function testGetWidth()
{
$photoSize = new PhotoSize();
$photoSize->setWidth(2);
$this->assertEquals(2, $photoSize->getWidth());
}
public function testSetHeight()
{
$photoSize = new PhotoSize();
$photoSize->setHeight(3);
$this->assertAttributeEquals(3, 'height', $photoSize);
}
public function testGetHeight()
{
$photoSize = new PhotoSize();
$photoSize->setHeight(4);
$this->assertEquals(4, $photoSize->getHeight());
}
public function testSetFileSize()
{
$photoSize = new PhotoSize();
$photoSize->setFileSize(5);
$this->assertAttributeEquals(5, 'fileSize', $photoSize);
}
public function testGetFileSize()
{
$photoSize = new PhotoSize();
$photoSize->setFileSize(6);
$this->assertEquals(6, $photoSize->getFileSize());
}
public function testFromResponse()
{
$photoSize = PhotoSize::fromResponse(array(
"file_id" => 'testFileId1',
'width' => 1,
'height' => 2,
'file_size' => 3
));
$this->assertInstanceOf('\TelegramBot\Api\Types\PhotoSize', $photoSize);
$this->assertAttributeEquals('testFileId1', 'fileId', $photoSize);
$this->assertAttributeEquals(1, 'width', $photoSize);
$this->assertAttributeEquals(2, 'height', $photoSize);
$this->assertAttributeEquals(3, 'fileSize', $photoSize);
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetFileSizeException()
{
$item = new PhotoSize();
$item->setFileSize('s');
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetHeightException()
{
$item = new PhotoSize();
$item->setHeight('s');
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetWidthException()
{
$item = new PhotoSize();
$item->setWidth('s');
}
}