|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Clubdeuce\WPLib\Components\GoogleMaps\Tests\Unit; |
|
4
|
|
|
|
|
5
|
|
|
use Clubdeuce\WPGoogleMaps\Google_Maps as GM; |
|
6
|
|
|
use Clubdeuce\WPLib\Components\Google_Maps; |
|
7
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Map; |
|
8
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Marker; |
|
9
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Tests\TestCase; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class testGoogleMaps |
|
13
|
|
|
* @package Clubdeuce\WPLib\Components\GoogleMaps\Tests\Unit |
|
14
|
|
|
* @coversDefaultClass \Clubdeuce\WPLib\Components\Google_Maps |
|
15
|
|
|
*/ |
|
16
|
|
|
class testGoogleMaps extends TestCase { |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @covers ::on_load |
|
20
|
|
|
*/ |
|
21
|
|
|
public function testAutoloadWorks() { |
|
22
|
|
|
|
|
23
|
|
|
Google_Maps::on_load(); |
|
24
|
|
|
$this->assertTrue(class_exists(GM::class)); |
|
25
|
|
|
|
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @covers ::make_new_map |
|
30
|
|
|
*/ |
|
31
|
|
|
public function testMakeNewMapReturnsMyMap() { |
|
32
|
|
|
|
|
33
|
|
|
$map = Google_Maps::make_new_map(array( |
|
34
|
|
|
'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35
|
|
|
)); |
|
36
|
|
|
|
|
37
|
|
|
$this->assertInstanceOf(Map::class, $map); |
|
38
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @covers ::make_marker_by_address |
|
43
|
|
|
*/ |
|
44
|
|
|
public function testMakeMarkerByAddress() { |
|
45
|
|
|
|
|
46
|
|
|
$marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
47
|
|
|
|
|
48
|
|
|
$this->assertInstanceOf(Marker::class, $marker); |
|
49
|
|
|
|
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @covers ::make_marker_by_position |
|
54
|
|
|
*/ |
|
55
|
|
|
public function testMakeMarkerByPosition() { |
|
56
|
|
|
|
|
57
|
|
|
$marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
58
|
|
|
|
|
59
|
|
|
$this->assertInstanceOf(Marker::class, $marker); |
|
60
|
|
|
$this->assertEquals(123.45, $marker->latitude()); |
|
61
|
|
|
$this->assertEquals(-123.45, $marker->longitude()); |
|
62
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
} |