Completed
Pull Request — master (#22)
by Daryl
07:43
created
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.
tests/integration/testGeocoder.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     private $_geocoder;
20 20
 
21 21
     public function setUp() {
22
-        $this->_geocoder = new Geocoder(array('api_key' => getenv('MAPS_API_KEY')));
22
+        $this->_geocoder = new Geocoder( array( 'api_key' => getenv( 'MAPS_API_KEY' ) ) );
23 23
 	    parent::setUp();
24 24
     }
25 25
 
@@ -27,26 +27,26 @@  discard block
 block discarded – undo
27 27
      * @covers ::geocode
28 28
      */
29 29
     public function testGeocode() {
30
-        $location = $this->_geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA');
31
-
32
-        $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location);
33
-        $this->assertInternalType('string', $location->address());
34
-        $this->assertInternalType('string', $location->formatted_address());
35
-        $this->assertInternalType('double', $location->latitude());
36
-        $this->assertInternalType('double', $location->longitude());
37
-        $this->assertInternalType('array', $location->viewport());
38
-        $this->assertArrayHasKey('northeast', $location->viewport());
39
-        $this->assertArrayHasKey('southwest', $location->viewport());
40
-        $this->assertInternalType('array', $location->viewport()['northeast']);
41
-        $this->assertArrayHasKey('lat', $location->viewport()['northeast']);
42
-        $this->assertArrayHasKey('lng', $location->viewport()['northeast']);
43
-        $this->assertInternalType('double', $location->viewport()['northeast']['lat']);
44
-        $this->assertInternalType('double', $location->viewport()['northeast']['lng']);
45
-        $this->assertInternalType('array', $location->viewport()['southwest']);
46
-        $this->assertArrayHasKey('lat', $location->viewport()['southwest']);
47
-        $this->assertArrayHasKey('lng', $location->viewport()['southwest']);
48
-        $this->assertInternalType('double', $location->viewport()['southwest']['lat']);
49
-        $this->assertInternalType('double', $location->viewport()['southwest']['lng']);
30
+        $location = $this->_geocoder->geocode( '1600 Amphitheatre Parkway, Mountain View, CA' );
31
+
32
+        $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location );
33
+        $this->assertInternalType( 'string', $location->address() );
34
+        $this->assertInternalType( 'string', $location->formatted_address() );
35
+        $this->assertInternalType( 'double', $location->latitude() );
36
+        $this->assertInternalType( 'double', $location->longitude() );
37
+        $this->assertInternalType( 'array', $location->viewport() );
38
+        $this->assertArrayHasKey( 'northeast', $location->viewport() );
39
+        $this->assertArrayHasKey( 'southwest', $location->viewport() );
40
+        $this->assertInternalType( 'array', $location->viewport()['northeast'] );
41
+        $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] );
42
+        $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] );
43
+        $this->assertInternalType( 'double', $location->viewport()['northeast']['lat'] );
44
+        $this->assertInternalType( 'double', $location->viewport()['northeast']['lng'] );
45
+        $this->assertInternalType( 'array', $location->viewport()['southwest'] );
46
+        $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] );
47
+        $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] );
48
+        $this->assertInternalType( 'double', $location->viewport()['southwest']['lat'] );
49
+        $this->assertInternalType( 'double', $location->viewport()['southwest']['lng'] );
50 50
     }
51 51
 
52 52
 }
Please login to merge, or discard this patch.
includes/class-location-model.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 			    break;
64 64
 		    }
65 65
 
66
-		    if ( ! isset( $this->_location ) ) {
66
+		    if ( !isset($this->_location) ) {
67 67
 		    	break;
68 68
 		    }
69 69
 
Please login to merge, or discard this patch.
includes/class-model-base.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace Clubdeuce\WPLib\Components\GoogleMaps;
4 4
 
5
-if ( ! class_exists( 'Clubdeuce\WPLib\Components\GoogleMaps\Model_Base' ) ):
5
+if ( !class_exists( 'Clubdeuce\WPLib\Components\GoogleMaps\Model_Base' ) ):
6 6
 /**
7 7
  * Class Model_Base
8 8
  * @package Clubdeuce\WPLib\Components\GoogleMaps
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 		$has = false;
20 20
 
21
-		if ( isset( $this->{$property} ) ) {
21
+		if ( isset($this->{$property} ) ) {
22 22
 			$has = true;
23 23
 		}
24 24
 
Please login to merge, or discard this patch.