forked from TelegramBot/Api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocationTest.php
More file actions
63 lines (53 loc) · 1.7 KB
/
LocationTest.php
File metadata and controls
63 lines (53 loc) · 1.7 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
<?php
namespace TelegramBot\Api\Test;
use TelegramBot\Api\Types\Location;
class LocationTest extends \PHPUnit_Framework_TestCase
{
public function testSetLatitude()
{
$location = new Location();
$location->setLatitude(55.585827);
$this->assertAttributeEquals(55.585827, 'latitude', $location);
}
public function testGetLatitude()
{
$location = new Location();
$location->setLatitude(55.585827);
$this->assertEquals(55.585827, $location->getLatitude());
}
public function testSetLongtitude()
{
$location = new Location();
$location->setLongitude(37.675309);
$this->assertAttributeEquals(37.675309, 'longitude', $location);
}
public function testGetLongtitude()
{
$location = new Location();
$location->setLongitude(37.675309);
$this->assertEquals(37.675309, $location->getLongitude());
}
public function testFromResponse()
{
$location = Location::fromResponse(array("latitude" => 55.585827, 'longitude' => 37.675309));
$this->assertInstanceOf('\TelegramBot\Api\Types\Location', $location);
$this->assertAttributeEquals(55.585827, 'latitude', $location);
$this->assertAttributeEquals(37.675309, 'longitude', $location);
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetLatitudeException()
{
$item = new Location();
$item->setLatitude('s');
}
/**
* @expectedException \TelegramBot\Api\InvalidArgumentException
*/
public function testSetLongitudeException()
{
$item = new Location();
$item->setLongitude('s');
}
}