Completed
Pull Request — master (#22)
by Daryl
01:32
created

TestMarker   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 4
dl 0
loc 56
rs 10
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\Tests\TestCase;
7
8
/**
9
 * Class TestMarker
10
 * @package            Clubdeuce\WPLib\Components\GoogleMaps\Tests\Integration
11
 * @coversDefaultClass Clubdeuce\WPLib\Components\GoogleMaps\Marker_Model
12
 * @group              Marker
13
 * @group              Integration
14
 */
15
class TestMarker extends TestCase {
16
17
	/**
18
	 * @var Marker
19
	 */
20
	private $_marker;
21
22
	public function setUp() {
23
		$this->_marker = new Marker(array(
24
			'address'  => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA',
25
			'title'    => 'Sample Location'
26
		));
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', $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