|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Clubdeuce\WPLib\Components\GoogleMaps\Tests\UnitTests; |
|
4
|
|
|
|
|
5
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Location_Model; |
|
6
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Tests\TestCase; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class TestLocationModel |
|
10
|
|
|
* @package Clubdeuce\WPLib\Components\GoogleMaps\Tests\UnitTests |
|
11
|
|
|
* @coversDefaultClass Clubdeuce\WPLib\Components\GoogleMaps\Location_Model |
|
12
|
|
|
*/ |
|
13
|
|
|
class TestLocationModel extends TestCase { |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @var Location_Model |
|
17
|
|
|
*/ |
|
18
|
|
|
private $_location; |
|
19
|
|
|
|
|
20
|
|
|
public function setUp() { |
|
21
|
|
|
$this->_location = new Location_Model([ |
|
22
|
|
|
'address' => '1600 Amphitheatre Parkway Mountain View CA', |
|
23
|
|
|
'formatted_address' => '1600 Amphitheatre Parkway, Mountain View, CA, 12345', |
|
24
|
|
|
'latitude' => 100.12345, |
|
25
|
|
|
'longitude' => -100.12345, |
|
26
|
|
|
'place_id' => 'foobar', |
|
27
|
|
|
'viewport' => ['foo', 'bar'], |
|
28
|
|
|
] ); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @covers ::__call |
|
33
|
|
|
*/ |
|
34
|
|
|
public function testAddress() { |
|
35
|
|
|
$this->assertEquals('1600 Amphitheatre Parkway Mountain View CA', $this->_location->address()); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @covers ::__call |
|
40
|
|
|
*/ |
|
41
|
|
|
public function testFormattedAddress() { |
|
42
|
|
|
$this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA, 12345', $this->_location->formatted_address()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @covers ::__call |
|
47
|
|
|
*/ |
|
48
|
|
|
public function testLatitude() { |
|
49
|
|
|
$this->assertEquals(100.12345, $this->_location->latitude()); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @covers ::__call |
|
54
|
|
|
*/ |
|
55
|
|
|
public function testLongitude() { |
|
56
|
|
|
$this->assertEquals(-100.12345, $this->_location->longitude()); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @covers ::__call() |
|
61
|
|
|
*/ |
|
62
|
|
|
public function testPlaceId() { |
|
63
|
|
|
$this->assertEquals('foobar', $this->_location->place_id()); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @covers ::__call() |
|
68
|
|
|
*/ |
|
69
|
|
|
public function testViewport() { |
|
70
|
|
|
$this->assertEquals(['foo', 'bar'], $this->_location->viewport()); |
|
71
|
|
|
} |
|
72
|
|
|
} |