1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Clubdeuce\WPLib\Components\GoogleMaps\Tests\Integration; |
4
|
|
|
|
5
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Marker; |
6
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Marker_Model; |
7
|
|
|
use Clubdeuce\WPLib\Components\GoogleMaps\Tests\TestCase; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class TestMarkerModel |
11
|
|
|
* @package Clubdeuce\WPLib\Components\GoogleMaps\Tests\Integration |
12
|
|
|
* @coversDefaultClass Clubdeuce\WPLib\Components\GoogleMaps\Marker_Model |
13
|
|
|
* @group Marker |
14
|
|
|
* @group Integration |
15
|
|
|
*/ |
16
|
|
|
class TestMarker extends TestCase { |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var Marker |
20
|
|
|
*/ |
21
|
|
|
private $_marker; |
22
|
|
|
|
23
|
|
|
public function setUp() { |
24
|
|
|
$this->_marker = new Marker(array( |
25
|
|
|
'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
26
|
|
|
'title' => 'Sample Location' |
27
|
|
|
)); |
28
|
|
|
parent::setUp(); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @covers ::location |
33
|
|
|
*/ |
34
|
|
|
public function testLocation() { |
35
|
|
|
$marker = $this->_marker; |
36
|
|
|
|
37
|
|
|
$this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $this->_marker->location()); |
|
|
|
|
38
|
|
|
$this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Marker_Label', $marker->label()); |
39
|
|
|
$this->assertInternalType('double', $marker->latitude()); |
40
|
|
|
$this->assertInternalType('double', $marker->longitude()); |
41
|
|
|
$this->assertInternalType('string', $marker->title()); |
42
|
|
|
$this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Info_Window', $marker->info_window()); |
43
|
|
|
$this->assertInternalType('array', $marker->marker_args()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @coversNothing |
48
|
|
|
*/ |
49
|
|
|
public function testInfoWindow() { |
50
|
|
|
$window = $this->_marker->info_window(); |
51
|
|
|
|
52
|
|
|
$this->assertInternalType('string', $window->content()); |
53
|
|
|
$this->assertInternalType('integer', $window->pixel_offset()); |
54
|
|
|
$this->assertInternalType('array', $window->position()); |
55
|
|
|
$this->assertNull($window->max_width()); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @coversNothing |
60
|
|
|
*/ |
61
|
|
|
public function testMarkerLabel() { |
62
|
|
|
$label = $this->_marker->label(); |
63
|
|
|
|
64
|
|
|
$this->assertInternalType('string', $label->color(), 'Color is not a string'); |
65
|
|
|
$this->assertInternalType('string', $label->font_family(), 'font_family is not a string'); |
66
|
|
|
$this->assertInternalType('string', $label->font_size(), 'font_size is not a string'); |
67
|
|
|
$this->assertInternalType('string', $label->font_weight()); |
68
|
|
|
$this->assertInternalType('string', $label->text()); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: