@@ -6,6 +6,6 @@ |
||
6 | 6 | * Class Marker_View |
7 | 7 | * @package Clubdeuce\WPLib\Components\GoogleMaps |
8 | 8 | */ |
9 | -class Marker_View extends \WPLib_View_Base { |
|
9 | +class Marker_View extends \WPLib_View_Base { |
|
10 | 10 | |
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -12,10 +12,10 @@ |
||
12 | 12 | <script type="application/javascript"> |
13 | 13 | jQuery(document).ready(function() { |
14 | 14 | generate_map( |
15 | - "<?php echo esc_js($map_id); ?>", |
|
16 | - <?php echo json_encode($map_params); ?>, |
|
17 | - <?php echo json_encode($markers); ?>, |
|
18 | - <?php echo json_encode($info_windows); ?> |
|
15 | + "<?php echo esc_js( $map_id ); ?>", |
|
16 | + <?php echo json_encode( $map_params ); ?>, |
|
17 | + <?php echo json_encode( $markers ); ?>, |
|
18 | + <?php echo json_encode( $info_windows ); ?> |
|
19 | 19 | ); |
20 | 20 | }); |
21 | 21 | </script> |
@@ -64,56 +64,56 @@ |
||
64 | 64 | return $reflection->invoke( $class, $args ); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * @return string |
|
69 | - */ |
|
67 | + /** |
|
68 | + * @return string |
|
69 | + */ |
|
70 | 70 | protected function get_sample_response() { |
71 | 71 | |
72 | - return file_get_contents( __DIR__ . '/geocoder-response.json' ); |
|
72 | + return file_get_contents( __DIR__ . '/geocoder-response.json' ); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
76 | - /** |
|
77 | - * @return Mock |
|
78 | - */ |
|
76 | + /** |
|
77 | + * @return Mock |
|
78 | + */ |
|
79 | 79 | protected function getMockGeocoder() { |
80 | 80 | |
81 | - /** |
|
82 | - * @var Mock $geocoder |
|
83 | - */ |
|
84 | - $geocoder = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder'); |
|
85 | - $geocoder->shouldReceive('geocode')->andReturn($this->getMockLocation()); |
|
81 | + /** |
|
82 | + * @var Mock $geocoder |
|
83 | + */ |
|
84 | + $geocoder = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder'); |
|
85 | + $geocoder->shouldReceive('geocode')->andReturn($this->getMockLocation()); |
|
86 | 86 | |
87 | - return $geocoder; |
|
87 | + return $geocoder; |
|
88 | 88 | } |
89 | 89 | |
90 | - /** |
|
91 | - * @return Mock |
|
92 | - */ |
|
90 | + /** |
|
91 | + * @return Mock |
|
92 | + */ |
|
93 | 93 | protected function getMockLocation() { |
94 | - /** |
|
95 | - * @var Mock $location |
|
96 | - */ |
|
97 | - $location = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMape\Location'); |
|
98 | - $location->shouldReceive('address')->andReturn('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA'); |
|
99 | - $location->shouldReceive('formatted_address')->andReturn('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA'); |
|
100 | - $location->shouldReceive('state')->andReturn('CA'); |
|
101 | - $location->shouldReceive('zip_code')->andReturn('94043'); |
|
102 | - $location->shouldReceive('latitude')->andReturn(37.4224764); |
|
103 | - $location->shouldReceive('longitude')->andReturn(-122.0842499); |
|
104 | - $location->shouldReceive('place_id')->andReturn('ChIJ2eUgeAK6j4ARbn5u_wAGqWA'); |
|
105 | - $location->shouldReceive('type')->andReturn('street_address'); |
|
106 | - $location->shouldReceive('viewport')->andReturn(array( |
|
107 | - 'northeast' => array( |
|
108 | - 'lat' => 37.4238253802915, |
|
109 | - 'lng' => -122.0829009197085 |
|
110 | - ), |
|
111 | - 'sourhwest' => array( |
|
112 | - 'lat' => 37.4211274197085, |
|
94 | + /** |
|
95 | + * @var Mock $location |
|
96 | + */ |
|
97 | + $location = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMape\Location'); |
|
98 | + $location->shouldReceive('address')->andReturn('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA'); |
|
99 | + $location->shouldReceive('formatted_address')->andReturn('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA'); |
|
100 | + $location->shouldReceive('state')->andReturn('CA'); |
|
101 | + $location->shouldReceive('zip_code')->andReturn('94043'); |
|
102 | + $location->shouldReceive('latitude')->andReturn(37.4224764); |
|
103 | + $location->shouldReceive('longitude')->andReturn(-122.0842499); |
|
104 | + $location->shouldReceive('place_id')->andReturn('ChIJ2eUgeAK6j4ARbn5u_wAGqWA'); |
|
105 | + $location->shouldReceive('type')->andReturn('street_address'); |
|
106 | + $location->shouldReceive('viewport')->andReturn(array( |
|
107 | + 'northeast' => array( |
|
108 | + 'lat' => 37.4238253802915, |
|
109 | + 'lng' => -122.0829009197085 |
|
110 | + ), |
|
111 | + 'sourhwest' => array( |
|
112 | + 'lat' => 37.4211274197085, |
|
113 | 113 | 'lng' => -122.0855988802915 |
114 | - ) |
|
115 | - )); |
|
114 | + ) |
|
115 | + )); |
|
116 | 116 | |
117 | - return $location; |
|
117 | + return $location; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | $reflection = new \ReflectionMethod( $class, $method ); |
44 | 44 | $reflection->setAccessible( true ); |
45 | - if (is_string($class)) { |
|
45 | + if ( is_string( $class ) ) { |
|
46 | 46 | $class = null; |
47 | 47 | } |
48 | 48 | return $reflection->invoke( $class ); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $reflection = new \ReflectionMethod( $class, $method ); |
60 | 60 | $reflection->setAccessible( true ); |
61 | - if (is_string($class)) { |
|
61 | + if ( is_string( $class ) ) { |
|
62 | 62 | $class = null; |
63 | 63 | } |
64 | 64 | return $reflection->invoke( $class, $args ); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function get_sample_response() { |
71 | 71 | |
72 | - return file_get_contents( __DIR__ . '/geocoder-response.json' ); |
|
72 | + return file_get_contents( __DIR__.'/geocoder-response.json' ); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * @var Mock $geocoder |
83 | 83 | */ |
84 | - $geocoder = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder'); |
|
85 | - $geocoder->shouldReceive('geocode')->andReturn($this->getMockLocation()); |
|
84 | + $geocoder = \Mockery::mock( '\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder' ); |
|
85 | + $geocoder->shouldReceive( 'geocode' )->andReturn( $this->getMockLocation() ); |
|
86 | 86 | |
87 | 87 | return $geocoder; |
88 | 88 | } |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * @var Mock $location |
96 | 96 | */ |
97 | - $location = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMape\Location'); |
|
98 | - $location->shouldReceive('address')->andReturn('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA'); |
|
99 | - $location->shouldReceive('formatted_address')->andReturn('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA'); |
|
100 | - $location->shouldReceive('state')->andReturn('CA'); |
|
101 | - $location->shouldReceive('zip_code')->andReturn('94043'); |
|
102 | - $location->shouldReceive('latitude')->andReturn(37.4224764); |
|
103 | - $location->shouldReceive('longitude')->andReturn(-122.0842499); |
|
104 | - $location->shouldReceive('place_id')->andReturn('ChIJ2eUgeAK6j4ARbn5u_wAGqWA'); |
|
105 | - $location->shouldReceive('type')->andReturn('street_address'); |
|
106 | - $location->shouldReceive('viewport')->andReturn(array( |
|
97 | + $location = \Mockery::mock( '\Clubdeuce\WPLib\Components\GoogleMape\Location' ); |
|
98 | + $location->shouldReceive( 'address' )->andReturn( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA' ); |
|
99 | + $location->shouldReceive( 'formatted_address' )->andReturn( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA' ); |
|
100 | + $location->shouldReceive( 'state' )->andReturn( 'CA' ); |
|
101 | + $location->shouldReceive( 'zip_code' )->andReturn( '94043' ); |
|
102 | + $location->shouldReceive( 'latitude' )->andReturn( 37.4224764 ); |
|
103 | + $location->shouldReceive( 'longitude' )->andReturn(-122.0842499); |
|
104 | + $location->shouldReceive( 'place_id' )->andReturn( 'ChIJ2eUgeAK6j4ARbn5u_wAGqWA' ); |
|
105 | + $location->shouldReceive( 'type' )->andReturn( 'street_address' ); |
|
106 | + $location->shouldReceive( 'viewport' )->andReturn( array( |
|
107 | 107 | 'northeast' => array( |
108 | 108 | 'lat' => 37.4238253802915, |
109 | 109 | 'lng' => -122.0829009197085 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'lat' => 37.4211274197085, |
113 | 113 | 'lng' => -122.0855988802915 |
114 | 114 | ) |
115 | - )); |
|
115 | + ) ); |
|
116 | 116 | |
117 | 117 | return $location; |
118 | 118 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * @param $address |
|
45 | + * @param string $address |
|
46 | 46 | * @param array $args |
47 | 47 | * |
48 | 48 | * @return Marker |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | |
15 | 15 | const INSTANCE_CLASS = 'Clubdeuce\WPLib\Components\GoogleMaps\Map'; |
16 | 16 | |
17 | - /** |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - protected static $_version = '0.1.6'; |
|
21 | - |
|
22 | - /** |
|
23 | - * |
|
24 | - */ |
|
17 | + /** |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + protected static $_version = '0.1.6'; |
|
21 | + |
|
22 | + /** |
|
23 | + * |
|
24 | + */ |
|
25 | 25 | static function on_load() { |
26 | 26 | |
27 | - require_once 'vendor/autoload.php'; |
|
27 | + require_once 'vendor/autoload.php'; |
|
28 | 28 | self::register_helper( '\Clubdeuce\WPGoogleMaps\Google_Maps', __CLASS__ ); |
29 | - \Clubdeuce\WPGoogleMaps\Google_Maps::initialize(); |
|
29 | + \Clubdeuce\WPGoogleMaps\Google_Maps::initialize(); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
@@ -41,32 +41,32 @@ discard block |
||
41 | 41 | |
42 | 42 | } |
43 | 43 | |
44 | - /** |
|
45 | - * @param $address |
|
46 | - * @param array $args |
|
47 | - * |
|
48 | - * @return Marker |
|
49 | - */ |
|
44 | + /** |
|
45 | + * @param $address |
|
46 | + * @param array $args |
|
47 | + * |
|
48 | + * @return Marker |
|
49 | + */ |
|
50 | 50 | static function make_marker_by_address( $address, $args = array() ) { |
51 | 51 | |
52 | - $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_address( $address, $args ); |
|
53 | - return new Marker( array( 'marker' => $marker ), $args ); |
|
52 | + $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_address( $address, $args ); |
|
53 | + return new Marker( array( 'marker' => $marker ), $args ); |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * @param float $lat |
|
59 | - * @param float $lng |
|
60 | - * @param array $args |
|
61 | - * |
|
62 | - * @return Marker |
|
63 | - */ |
|
64 | - static function make_marker_by_position( $lat, $lng, $args = array() ) { |
|
57 | + /** |
|
58 | + * @param float $lat |
|
59 | + * @param float $lng |
|
60 | + * @param array $args |
|
61 | + * |
|
62 | + * @return Marker |
|
63 | + */ |
|
64 | + static function make_marker_by_position( $lat, $lng, $args = array() ) { |
|
65 | 65 | |
66 | - $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_position( $lat, $lng, $args ); |
|
67 | - return new Marker( array( 'marker' => $marker ), $args ); |
|
66 | + $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_position( $lat, $lng, $args ); |
|
67 | + return new Marker( array( 'marker' => $marker ), $args ); |
|
68 | 68 | |
69 | - } |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | Google_Maps::on_load(); |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | -define('SRC_DIR', dirname(__DIR__)); |
|
3 | -define('VENDOR_DIRECTORY', SRC_DIR . '/vendor'); |
|
4 | -define('TEST_INCLUDES_DIR', SRC_DIR . '/includes'); |
|
2 | +define( 'SRC_DIR', dirname( __DIR__ ) ); |
|
3 | +define( 'VENDOR_DIRECTORY', SRC_DIR.'/vendor' ); |
|
4 | +define( 'TEST_INCLUDES_DIR', SRC_DIR.'/includes' ); |
|
5 | 5 | |
6 | -require_once getenv( 'WP_TESTS_DIR' ) . '/tests/phpunit/includes/functions.php'; |
|
7 | -require getenv( 'WP_TESTS_DIR' ) . '/tests/phpunit/includes/bootstrap.php'; |
|
6 | +require_once getenv( 'WP_TESTS_DIR' ).'/tests/phpunit/includes/functions.php'; |
|
7 | +require getenv( 'WP_TESTS_DIR' ).'/tests/phpunit/includes/bootstrap.php'; |
|
8 | 8 | |
9 | 9 | require 'includes/testCase.php'; |
10 | 10 | |
11 | -if ( ! function_exists( 'wplib_define' ) ) { |
|
12 | - require( VENDOR_DIRECTORY . '/wplib/wplib/defines.php' ); |
|
11 | +if ( !function_exists( 'wplib_define' ) ) { |
|
12 | + require(VENDOR_DIRECTORY.'/wplib/wplib/defines.php'); |
|
13 | 13 | wplib_define( 'WPLib_Runmode', 'PRODUCTION' ); |
14 | 14 | wplib_define( 'WPLib_Stability', 'EXPERIMENTAL' ); |
15 | 15 | } |
16 | -require_once VENDOR_DIRECTORY . '/autoload.php'; |
|
16 | +require_once VENDOR_DIRECTORY.'/autoload.php'; |
|
17 | 17 | |
18 | -require_once VENDOR_DIRECTORY . '/wplib/wplib/wplib.php'; |
|
18 | +require_once VENDOR_DIRECTORY.'/wplib/wplib/wplib.php'; |
|
19 | 19 | WPLib::initialize(); |
20 | 20 | |
21 | 21 | \Clubdeuce\WPLib\Components\Google_Maps::initialize(); |
@@ -15,48 +15,48 @@ |
||
15 | 15 | */ |
16 | 16 | class testGoogleMaps extends TestCase { |
17 | 17 | |
18 | - /** |
|
19 | - * @covers ::on_load |
|
20 | - */ |
|
21 | - public function testAutoloadWorks() { |
|
18 | + /** |
|
19 | + * @covers ::on_load |
|
20 | + */ |
|
21 | + public function testAutoloadWorks() { |
|
22 | 22 | |
23 | - Google_Maps::on_load(); |
|
24 | - $this->assertTrue(class_exists(GM::class)); |
|
23 | + Google_Maps::on_load(); |
|
24 | + $this->assertTrue(class_exists(GM::class)); |
|
25 | 25 | |
26 | - } |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @covers ::make_new_map |
|
30 | - */ |
|
31 | - public function testMakeNewMapReturnsMyMap() { |
|
28 | + /** |
|
29 | + * @covers ::make_new_map |
|
30 | + */ |
|
31 | + public function testMakeNewMapReturnsMyMap() { |
|
32 | 32 | |
33 | - $map = Google_Maps::make_new_map(array( |
|
34 | - 'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35 | - )); |
|
33 | + $map = Google_Maps::make_new_map(array( |
|
34 | + 'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35 | + )); |
|
36 | 36 | |
37 | - $this->assertInstanceOf(Map::class, $map); |
|
37 | + $this->assertInstanceOf(Map::class, $map); |
|
38 | 38 | |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @covers ::make_marker_by_address |
|
43 | - */ |
|
44 | - public function testMakeMarkerByAddress() { |
|
41 | + /** |
|
42 | + * @covers ::make_marker_by_address |
|
43 | + */ |
|
44 | + public function testMakeMarkerByAddress() { |
|
45 | 45 | |
46 | - $marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
46 | + $marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
47 | 47 | |
48 | - $this->assertInstanceOf(Marker::class, $marker); |
|
48 | + $this->assertInstanceOf(Marker::class, $marker); |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @covers ::make_marker_by_position |
|
54 | - */ |
|
55 | - public function testMakeMarkerByPosition() { |
|
52 | + /** |
|
53 | + * @covers ::make_marker_by_position |
|
54 | + */ |
|
55 | + public function testMakeMarkerByPosition() { |
|
56 | 56 | |
57 | - $marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
57 | + $marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
58 | 58 | |
59 | - $this->assertInstanceOf(Marker::class, $marker); |
|
59 | + $this->assertInstanceOf(Marker::class, $marker); |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function testAutoloadWorks() { |
22 | 22 | |
23 | 23 | Google_Maps::on_load(); |
24 | - $this->assertTrue(class_exists(GM::class)); |
|
24 | + $this->assertTrue( class_exists( GM::class ) ); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function testMakeNewMapReturnsMyMap() { |
32 | 32 | |
33 | - $map = Google_Maps::make_new_map(array( |
|
34 | - 'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35 | - )); |
|
33 | + $map = Google_Maps::make_new_map( array( |
|
34 | + 'center' => array( 'lat' => 123.45, 'lng' => '-123.45' ) |
|
35 | + ) ); |
|
36 | 36 | |
37 | - $this->assertInstanceOf(Map::class, $map); |
|
37 | + $this->assertInstanceOf( Map::class, $map ); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function testMakeMarkerByAddress() { |
45 | 45 | |
46 | - $marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
46 | + $marker = Google_Maps::make_marker_by_address( '1600 Pennsylvania Avenue NW Washington DC' ); |
|
47 | 47 | |
48 | - $this->assertInstanceOf(Marker::class, $marker); |
|
48 | + $this->assertInstanceOf( Marker::class, $marker ); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function testMakeMarkerByPosition() { |
56 | 56 | |
57 | - $marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
57 | + $marker = Google_Maps::make_marker_by_position( 123.45, -123.45 ); |
|
58 | 58 | |
59 | - $this->assertInstanceOf(Marker::class, $marker); |
|
59 | + $this->assertInstanceOf( Marker::class, $marker ); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -14,61 +14,61 @@ |
||
14 | 14 | */ |
15 | 15 | class TestInfoWindowModel extends TestCase { |
16 | 16 | |
17 | - /** |
|
18 | - * @var Info_Window_Model |
|
19 | - */ |
|
20 | - private $_model; |
|
17 | + /** |
|
18 | + * @var Info_Window_Model |
|
19 | + */ |
|
20 | + private $_model; |
|
21 | 21 | |
22 | - public function setUp() { |
|
22 | + public function setUp() { |
|
23 | 23 | |
24 | - $this->_model = new Info_Window_Model(array('info_window' => self::_get_mock_info_window())); |
|
25 | - parent::setUp(); |
|
26 | - } |
|
24 | + $this->_model = new Info_Window_Model(array('info_window' => self::_get_mock_info_window())); |
|
25 | + parent::setUp(); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @covers ::__construct |
|
30 | - * @covers ::__call |
|
31 | - */ |
|
32 | - public function testInfoWindowIsSet() { |
|
33 | - $this->assertEquals(self::_get_mock_info_window(), $this->_model->info_window()); |
|
34 | - } |
|
28 | + /** |
|
29 | + * @covers ::__construct |
|
30 | + * @covers ::__call |
|
31 | + */ |
|
32 | + public function testInfoWindowIsSet() { |
|
33 | + $this->assertEquals(self::_get_mock_info_window(), $this->_model->info_window()); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @covers ::has_info_window |
|
38 | - */ |
|
39 | - public function testHasInfoWindow() { |
|
40 | - $this->assertTrue($this->_model->has_info_window()); |
|
41 | - } |
|
36 | + /** |
|
37 | + * @covers ::has_info_window |
|
38 | + */ |
|
39 | + public function testHasInfoWindow() { |
|
40 | + $this->assertTrue($this->_model->has_info_window()); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @covers ::__call |
|
45 | - */ |
|
46 | - public function testMagicMethods() { |
|
47 | - $this->assertEquals('Sample Info Window Content', $this->_model->content()); |
|
48 | - $this->assertEquals('12', $this->_model->pixel_offset()); |
|
49 | - $this->assertEquals(array('lat' => 123.45, 'lng' => -123.45), $this->_model->position()); |
|
50 | - $this->assertEquals('450px', $this->_model->max_width()); |
|
51 | - } |
|
43 | + /** |
|
44 | + * @covers ::__call |
|
45 | + */ |
|
46 | + public function testMagicMethods() { |
|
47 | + $this->assertEquals('Sample Info Window Content', $this->_model->content()); |
|
48 | + $this->assertEquals('12', $this->_model->pixel_offset()); |
|
49 | + $this->assertEquals(array('lat' => 123.45, 'lng' => -123.45), $this->_model->position()); |
|
50 | + $this->assertEquals('450px', $this->_model->max_width()); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @covers ::__call |
|
55 | - */ |
|
56 | - public function testMagicMethodNull() { |
|
57 | - $window = new Info_Window_Model(array('info_window' => null)); |
|
53 | + /** |
|
54 | + * @covers ::__call |
|
55 | + */ |
|
56 | + public function testMagicMethodNull() { |
|
57 | + $window = new Info_Window_Model(array('info_window' => null)); |
|
58 | 58 | |
59 | - $this->assertNull($window->content()); |
|
60 | - } |
|
59 | + $this->assertNull($window->content()); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return \Mockery\MockInterface |
|
64 | - */ |
|
65 | - private function _get_mock_info_window() { |
|
66 | - $mock = \Mockery::mock(MIW::class); |
|
67 | - $mock->shouldReceive('content')->andReturn('Sample Info Window Content'); |
|
68 | - $mock->shouldReceive('pixel_offset')->andReturn(12); |
|
69 | - $mock->shouldReceive('position')->andReturn(array('lat' => 123.45, 'lng' => -123.45)); |
|
70 | - $mock->shouldReceive('max_width')->andReturn('450px'); |
|
62 | + /** |
|
63 | + * @return \Mockery\MockInterface |
|
64 | + */ |
|
65 | + private function _get_mock_info_window() { |
|
66 | + $mock = \Mockery::mock(MIW::class); |
|
67 | + $mock->shouldReceive('content')->andReturn('Sample Info Window Content'); |
|
68 | + $mock->shouldReceive('pixel_offset')->andReturn(12); |
|
69 | + $mock->shouldReceive('position')->andReturn(array('lat' => 123.45, 'lng' => -123.45)); |
|
70 | + $mock->shouldReceive('max_width')->andReturn('450px'); |
|
71 | 71 | |
72 | - return $mock; |
|
73 | - } |
|
72 | + return $mock; |
|
73 | + } |
|
74 | 74 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function setUp() { |
23 | 23 | |
24 | - $this->_model = new Info_Window_Model(array('info_window' => self::_get_mock_info_window())); |
|
24 | + $this->_model = new Info_Window_Model( array( 'info_window' => self::_get_mock_info_window() ) ); |
|
25 | 25 | parent::setUp(); |
26 | 26 | } |
27 | 27 | |
@@ -30,44 +30,44 @@ discard block |
||
30 | 30 | * @covers ::__call |
31 | 31 | */ |
32 | 32 | public function testInfoWindowIsSet() { |
33 | - $this->assertEquals(self::_get_mock_info_window(), $this->_model->info_window()); |
|
33 | + $this->assertEquals( self::_get_mock_info_window(), $this->_model->info_window() ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @covers ::has_info_window |
38 | 38 | */ |
39 | 39 | public function testHasInfoWindow() { |
40 | - $this->assertTrue($this->_model->has_info_window()); |
|
40 | + $this->assertTrue( $this->_model->has_info_window() ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @covers ::__call |
45 | 45 | */ |
46 | 46 | public function testMagicMethods() { |
47 | - $this->assertEquals('Sample Info Window Content', $this->_model->content()); |
|
48 | - $this->assertEquals('12', $this->_model->pixel_offset()); |
|
49 | - $this->assertEquals(array('lat' => 123.45, 'lng' => -123.45), $this->_model->position()); |
|
50 | - $this->assertEquals('450px', $this->_model->max_width()); |
|
47 | + $this->assertEquals( 'Sample Info Window Content', $this->_model->content() ); |
|
48 | + $this->assertEquals( '12', $this->_model->pixel_offset() ); |
|
49 | + $this->assertEquals( array( 'lat' => 123.45, 'lng' => -123.45 ), $this->_model->position() ); |
|
50 | + $this->assertEquals( '450px', $this->_model->max_width() ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @covers ::__call |
55 | 55 | */ |
56 | 56 | public function testMagicMethodNull() { |
57 | - $window = new Info_Window_Model(array('info_window' => null)); |
|
57 | + $window = new Info_Window_Model( array( 'info_window' => null ) ); |
|
58 | 58 | |
59 | - $this->assertNull($window->content()); |
|
59 | + $this->assertNull( $window->content() ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return \Mockery\MockInterface |
64 | 64 | */ |
65 | 65 | private function _get_mock_info_window() { |
66 | - $mock = \Mockery::mock(MIW::class); |
|
67 | - $mock->shouldReceive('content')->andReturn('Sample Info Window Content'); |
|
68 | - $mock->shouldReceive('pixel_offset')->andReturn(12); |
|
69 | - $mock->shouldReceive('position')->andReturn(array('lat' => 123.45, 'lng' => -123.45)); |
|
70 | - $mock->shouldReceive('max_width')->andReturn('450px'); |
|
66 | + $mock = \Mockery::mock( MIW::class ); |
|
67 | + $mock->shouldReceive( 'content' )->andReturn( 'Sample Info Window Content' ); |
|
68 | + $mock->shouldReceive( 'pixel_offset' )->andReturn( 12 ); |
|
69 | + $mock->shouldReceive( 'position' )->andReturn( array( 'lat' => 123.45, 'lng' => -123.45 ) ); |
|
70 | + $mock->shouldReceive( 'max_width' )->andReturn( '450px' ); |
|
71 | 71 | |
72 | 72 | return $mock; |
73 | 73 | } |
@@ -15,65 +15,65 @@ |
||
15 | 15 | */ |
16 | 16 | class TestLocationModel extends TestCase { |
17 | 17 | |
18 | - /** |
|
19 | - * @var Location_Model |
|
20 | - */ |
|
21 | - private $_location; |
|
18 | + /** |
|
19 | + * @var Location_Model |
|
20 | + */ |
|
21 | + private $_location; |
|
22 | 22 | |
23 | - public function setUp() { |
|
24 | - $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
|
25 | - parent::setUp(); |
|
26 | - } |
|
23 | + public function setUp() { |
|
24 | + $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
|
25 | + parent::setUp(); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @covers ::__construct |
|
30 | - * @covers ::__call |
|
31 | - */ |
|
32 | - public function testConstruct() { |
|
33 | - $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
|
34 | - } |
|
28 | + /** |
|
29 | + * @covers ::__construct |
|
30 | + * @covers ::__call |
|
31 | + */ |
|
32 | + public function testConstruct() { |
|
33 | + $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @covers ::__construct |
|
38 | - * @covers ::__call |
|
39 | - */ |
|
40 | - public function testConstructDefaults() { |
|
41 | - $location = new Location_Model(); |
|
42 | - $this->assertTrue($location->has_location()); |
|
43 | - $this->assertInstanceOf(Loc::class, $location->location()); |
|
44 | - } |
|
36 | + /** |
|
37 | + * @covers ::__construct |
|
38 | + * @covers ::__call |
|
39 | + */ |
|
40 | + public function testConstructDefaults() { |
|
41 | + $location = new Location_Model(); |
|
42 | + $this->assertTrue($location->has_location()); |
|
43 | + $this->assertInstanceOf(Loc::class, $location->location()); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @covers ::__construct |
|
48 | - * @covers ::has_location |
|
49 | - */ |
|
50 | - public function testHasLocation() { |
|
51 | - $this->assertTrue($this->_location->has_location()); |
|
52 | - } |
|
46 | + /** |
|
47 | + * @covers ::__construct |
|
48 | + * @covers ::has_location |
|
49 | + */ |
|
50 | + public function testHasLocation() { |
|
51 | + $this->assertTrue($this->_location->has_location()); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @covers ::__call |
|
56 | - */ |
|
57 | - public function testMagicMethodCall() { |
|
58 | - $this->assertEquals('bar', $this->_location->foo()); |
|
59 | - } |
|
54 | + /** |
|
55 | + * @covers ::__call |
|
56 | + */ |
|
57 | + public function testMagicMethodCall() { |
|
58 | + $this->assertEquals('bar', $this->_location->foo()); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @covers ::__call |
|
63 | - */ |
|
64 | - public function testMagicMethodCallNull() { |
|
65 | - $location = new Location_Model(array('location' => null)); |
|
66 | - $this->assertNull($location->latitude()); |
|
67 | - } |
|
61 | + /** |
|
62 | + * @covers ::__call |
|
63 | + */ |
|
64 | + public function testMagicMethodCallNull() { |
|
65 | + $location = new Location_Model(array('location' => null)); |
|
66 | + $this->assertNull($location->latitude()); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return \Mockery\MockInterface |
|
71 | - */ |
|
72 | - private function _getMockLocation() { |
|
73 | - $location = \Mockery::mock(MLoc::class); |
|
69 | + /** |
|
70 | + * @return \Mockery\MockInterface |
|
71 | + */ |
|
72 | + private function _getMockLocation() { |
|
73 | + $location = \Mockery::mock(MLoc::class); |
|
74 | 74 | |
75 | - $location->shouldReceive('foo')->andReturn('bar'); |
|
75 | + $location->shouldReceive('foo')->andReturn('bar'); |
|
76 | 76 | |
77 | - return $location; |
|
78 | - } |
|
77 | + return $location; |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | private $_location; |
22 | 22 | |
23 | 23 | public function setUp() { |
24 | - $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
|
24 | + $this->_location = new Location_Model( array( 'location' => $this->_getMockLocation() ) ); |
|
25 | 25 | parent::setUp(); |
26 | 26 | } |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @covers ::__call |
31 | 31 | */ |
32 | 32 | public function testConstruct() { |
33 | - $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
|
33 | + $this->assertEquals( self::_getMockLocation(), $this->_location->location() ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function testConstructDefaults() { |
41 | 41 | $location = new Location_Model(); |
42 | - $this->assertTrue($location->has_location()); |
|
43 | - $this->assertInstanceOf(Loc::class, $location->location()); |
|
42 | + $this->assertTrue( $location->has_location() ); |
|
43 | + $this->assertInstanceOf( Loc::class, $location->location() ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,31 +48,31 @@ discard block |
||
48 | 48 | * @covers ::has_location |
49 | 49 | */ |
50 | 50 | public function testHasLocation() { |
51 | - $this->assertTrue($this->_location->has_location()); |
|
51 | + $this->assertTrue( $this->_location->has_location() ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @covers ::__call |
56 | 56 | */ |
57 | 57 | public function testMagicMethodCall() { |
58 | - $this->assertEquals('bar', $this->_location->foo()); |
|
58 | + $this->assertEquals( 'bar', $this->_location->foo() ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @covers ::__call |
63 | 63 | */ |
64 | 64 | public function testMagicMethodCallNull() { |
65 | - $location = new Location_Model(array('location' => null)); |
|
66 | - $this->assertNull($location->latitude()); |
|
65 | + $location = new Location_Model( array( 'location' => null ) ); |
|
66 | + $this->assertNull( $location->latitude() ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @return \Mockery\MockInterface |
71 | 71 | */ |
72 | 72 | private function _getMockLocation() { |
73 | - $location = \Mockery::mock(MLoc::class); |
|
73 | + $location = \Mockery::mock( MLoc::class ); |
|
74 | 74 | |
75 | - $location->shouldReceive('foo')->andReturn('bar'); |
|
75 | + $location->shouldReceive( 'foo' )->andReturn( 'bar' ); |
|
76 | 76 | |
77 | 77 | return $location; |
78 | 78 | } |
@@ -14,58 +14,58 @@ |
||
14 | 14 | */ |
15 | 15 | class TestMarker extends TestCase { |
16 | 16 | |
17 | - /** |
|
18 | - * @var Marker |
|
19 | - */ |
|
20 | - private $_marker; |
|
17 | + /** |
|
18 | + * @var Marker |
|
19 | + */ |
|
20 | + private $_marker; |
|
21 | 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 | - )); |
|
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 | 27 | |
28 | - parent::setUp(); |
|
29 | - } |
|
28 | + parent::setUp(); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * @covers ::location |
|
33 | - */ |
|
34 | - public function testLocation() { |
|
35 | - $marker = $this->_marker; |
|
31 | + /** |
|
32 | + * @covers ::location |
|
33 | + */ |
|
34 | + public function testLocation() { |
|
35 | + $marker = $this->_marker; |
|
36 | 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 | - } |
|
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 | 45 | |
46 | - /** |
|
47 | - * @coversNothing |
|
48 | - */ |
|
49 | - public function testInfoWindow() { |
|
50 | - $window = $this->_marker->info_window(); |
|
46 | + /** |
|
47 | + * @coversNothing |
|
48 | + */ |
|
49 | + public function testInfoWindow() { |
|
50 | + $window = $this->_marker->info_window(); |
|
51 | 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 | - } |
|
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 | 57 | |
58 | - /** |
|
59 | - * @coversNothing |
|
60 | - */ |
|
61 | - public function testMarkerLabel() { |
|
62 | - $label = $this->_marker->label(); |
|
58 | + /** |
|
59 | + * @coversNothing |
|
60 | + */ |
|
61 | + public function testMarkerLabel() { |
|
62 | + $label = $this->_marker->label(); |
|
63 | 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 | - } |
|
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 | 70 | |
71 | 71 | } |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | private $_marker; |
21 | 21 | |
22 | 22 | public function setUp() { |
23 | - $this->_marker = new Marker(array( |
|
23 | + $this->_marker = new Marker( array( |
|
24 | 24 | 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
25 | 25 | 'title' => 'Sample Location' |
26 | - )); |
|
26 | + ) ); |
|
27 | 27 | |
28 | 28 | parent::setUp(); |
29 | 29 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | public function testLocation() { |
35 | 35 | $marker = $this->_marker; |
36 | 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()); |
|
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 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | public function testInfoWindow() { |
50 | 50 | $window = $this->_marker->info_window(); |
51 | 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()); |
|
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 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | public function testMarkerLabel() { |
62 | 62 | $label = $this->_marker->label(); |
63 | 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()); |
|
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 | 69 | } |
70 | 70 | |
71 | 71 | } |