forked from TelegramBot/Api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileTest.php
More file actions
83 lines (72 loc) · 2.13 KB
/
Copy pathFileTest.php
File metadata and controls
83 lines (72 loc) · 2.13 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
<?php
namespace TelegramBot\Api\Test;
use TelegramBot\Api\Types\File;
class FileTest extends \PHPUnit_Framework_TestCase
{
public function testSetFileId()
{
$item = new File();
$item->setFileId('testfileId');
$this->assertAttributeEquals('testfileId', 'fileId', $item);
}
public function testGetFileId()
{
$item = new File();
$item->setFileId('testfileId');
$this->assertEquals('testfileId', $item->getFileId());
}
public function testSetFileSize()
{
$item = new File();
$item->setFileSize(5);
$this->assertAttributeEquals(5, 'fileSize', $item);
}
public function testGetFileSize()
{
$item = new File();
$item->setFileSize(6);
$this->assertEquals(6, $item->getFileSize());
}
public function testSetFilePath()
{
$item = new File();
$item->setFilePath('testfilepath');
$this->assertAttributeEquals('testfilepath', 'filePath', $item);
}
public function testGetFilePath()
{
$item = new File();
$item->setFilePath('testfilepath');
$this->assertEquals('testfilepath', $item->getFilePath());
}
public function testFromResponse()
{
$item = File::fromResponse(array(
'file_id' => 'testFileId1',
'file_size' => 3,
'file_path' => 'testfilepath'
));
$this->assertInstanceOf('\TelegramBot\Api\Types\File', $item);
$this->assertAttributeEquals('testFileId1', 'fileId', $item);
$this->assertAttributeEquals(3, 'fileSize', $item);
$this->assertAttributeEquals('testfilepath', 'filePath', $item);
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testFromResponseException()
{
$item = File::fromResponse(array(
'file_size' => 3,
'file_path' => 'testfilepath'
));
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetFileSizeException()
{
$item = new File();
$item->setFileSize('s');
}
}