Completed
Pull Request — master (#22)
by Daryl
07:43
created
includes/class-marker-view.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,6 +6,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
templates/map-view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
tests/includes/testCase.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
112 112
 			    'lat'   => 37.4211274197085,
113 113
                 'lng'   => -122.0855988802915
114 114
 		    )
115
-	    ));
115
+	    ) );
116 116
 
117 117
 	    return $location;
118 118
     }
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
tests/unit/testGoogleMaps.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
tests/unit/testInfoWindowModel.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
tests/unit/testLocationModel.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
tests/integration/testMarker.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
tests/integration/testGoogleMaps.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 class TestGoogleMaps extends TestCase {
16 16
 
17 17
 	public function setUp() {
18
-		Google_Maps::register_script_condition(true);
18
+		Google_Maps::register_script_condition( true );
19 19
 		wp_enqueue_scripts();
20 20
 	}
21 21
 
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	 * @coversNothing
24 24
 	 */
25 25
 	function testScriptRegistered() {
26
-		$this->assertTrue(wp_script_is('google-maps', 'registered'));
27
-		$this->assertTrue(wp_script_is('map-control', 'registered'));
26
+		$this->assertTrue( wp_script_is( 'google-maps', 'registered' ) );
27
+		$this->assertTrue( wp_script_is( 'map-control', 'registered' ) );
28 28
 	}
29 29
 
30 30
 	/**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	function testScriptEnqueued() {
35 35
 
36
-		$this->assertTrue(wp_script_is('google-maps', 'enqueued'));
37
-		$this->assertTrue(wp_script_is('map-control', 'enqueued'));
36
+		$this->assertTrue( wp_script_is( 'google-maps', 'enqueued' ) );
37
+		$this->assertTrue( wp_script_is( 'map-control', 'enqueued' ) );
38 38
 
39 39
 	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.