@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function html_id() { |
| 85 | 85 | |
| 86 | - if ( ! isset( $this->_html_id ) ) { |
|
| 86 | + if ( !isset($this->_html_id) ) { |
|
| 87 | 87 | $this->_html_id = sprintf( 'map-%1$s', md5( serialize( array( $this->center(), $this->markers() ) ) ) ); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | return array( |
| 127 | 127 | 'center' => $this->center(), |
| 128 | - 'zoom' => (int)$this->zoom() |
|
| 128 | + 'zoom' => ( int ) $this->zoom() |
|
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | } |
@@ -1,38 +1,38 @@ |
||
| 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 | -require VENDOR_DIRECTORY . '/autoload.php'; |
|
| 11 | +require VENDOR_DIRECTORY.'/autoload.php'; |
|
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'wplib_define' ) ) { |
|
| 14 | - require( VENDOR_DIRECTORY . '/wplib/wplib/defines.php' ); |
|
| 13 | +if ( !function_exists( 'wplib_define' ) ) { |
|
| 14 | + require(VENDOR_DIRECTORY.'/wplib/wplib/defines.php'); |
|
| 15 | 15 | wplib_define( 'WPLib_Runmode', 'PRODUCTION' ); |
| 16 | 16 | wplib_define( 'WPLib_Stability', 'EXPERIMENTAL' ); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -require VENDOR_DIRECTORY . '/wplib/wplib/wplib.php'; |
|
| 19 | +require VENDOR_DIRECTORY.'/wplib/wplib/wplib.php'; |
|
| 20 | 20 | WPLib::initialize(); |
| 21 | 21 | |
| 22 | -require_once dirname(__DIR__) . '/includes/class-geocoder.php'; |
|
| 23 | -require_once dirname(__DIR__) . '/includes/class-info-window-model.php'; |
|
| 24 | -require_once dirname(__DIR__) . '/includes/class-info-window-view.php'; |
|
| 25 | -require_once dirname(__DIR__) . '/includes/class-info-window.php'; |
|
| 26 | -require_once dirname(__DIR__) . '/includes/class-location.php'; |
|
| 27 | -require_once dirname(__DIR__) . '/includes/class-location-model.php'; |
|
| 28 | -require_once dirname(__DIR__) . '/includes/class-location-view.php'; |
|
| 29 | -require_once dirname(__DIR__) . '/includes/class-map.php'; |
|
| 30 | -require_once dirname(__DIR__) . '/includes/class-map-model.php'; |
|
| 31 | -require_once dirname(__DIR__) . '/includes/class-map-view.php'; |
|
| 32 | -require_once dirname(__DIR__) . '/includes/class-marker.php'; |
|
| 33 | -require_once dirname(__DIR__) . '/includes/class-marker-label.php'; |
|
| 34 | -require_once dirname(__DIR__) . '/includes/class-marker-label-model.php'; |
|
| 35 | -require_once dirname(__DIR__) . '/includes/class-marker-label-view.php'; |
|
| 36 | -require_once dirname(__DIR__) . '/includes/class-marker-model.php'; |
|
| 37 | -require_once dirname(__DIR__) . '/includes/class-marker-view.php'; |
|
| 38 | -require_once dirname(__DIR__) . '/component-google-maps.php'; |
|
| 22 | +require_once dirname( __DIR__ ).'/includes/class-geocoder.php'; |
|
| 23 | +require_once dirname( __DIR__ ).'/includes/class-info-window-model.php'; |
|
| 24 | +require_once dirname( __DIR__ ).'/includes/class-info-window-view.php'; |
|
| 25 | +require_once dirname( __DIR__ ).'/includes/class-info-window.php'; |
|
| 26 | +require_once dirname( __DIR__ ).'/includes/class-location.php'; |
|
| 27 | +require_once dirname( __DIR__ ).'/includes/class-location-model.php'; |
|
| 28 | +require_once dirname( __DIR__ ).'/includes/class-location-view.php'; |
|
| 29 | +require_once dirname( __DIR__ ).'/includes/class-map.php'; |
|
| 30 | +require_once dirname( __DIR__ ).'/includes/class-map-model.php'; |
|
| 31 | +require_once dirname( __DIR__ ).'/includes/class-map-view.php'; |
|
| 32 | +require_once dirname( __DIR__ ).'/includes/class-marker.php'; |
|
| 33 | +require_once dirname( __DIR__ ).'/includes/class-marker-label.php'; |
|
| 34 | +require_once dirname( __DIR__ ).'/includes/class-marker-label-model.php'; |
|
| 35 | +require_once dirname( __DIR__ ).'/includes/class-marker-label-view.php'; |
|
| 36 | +require_once dirname( __DIR__ ).'/includes/class-marker-model.php'; |
|
| 37 | +require_once dirname( __DIR__ ).'/includes/class-marker-view.php'; |
|
| 38 | +require_once dirname( __DIR__ ).'/component-google-maps.php'; |
|
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | * @covers ::_wp_enqueue_scripts_9 |
| 19 | 19 | */ |
| 20 | 20 | function testScriptRegistered() { |
| 21 | - $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
| 22 | - $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
| 21 | + $this->assertTrue( wp_script_is( 'google-maps', 'registered' ) ); |
|
| 22 | + $this->assertTrue( wp_script_is( 'map-control', 'registered' ) ); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function testScriptEnqueued() { |
| 30 | 30 | |
| 31 | - Google_Maps::register_script_condition(function(){return true;}); |
|
| 31 | + Google_Maps::register_script_condition( function() {return true; }); |
|
| 32 | 32 | |
| 33 | - $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
| 34 | - $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
| 33 | + $this->assertTrue( wp_script_is( 'google-maps', 'enqueued' ) ); |
|
| 34 | + $this->assertTrue( wp_script_is( 'map-control', 'enqueued' ) ); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ 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 | } |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | private $_marker; |
| 22 | 22 | |
| 23 | 23 | public function setUp() { |
| 24 | - $this->_marker = new Marker(array( |
|
| 24 | + $this->_marker = new Marker( array( |
|
| 25 | 25 | 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
| 26 | 26 | 'title' => 'Sample Location' |
| 27 | - )); |
|
| 27 | + ) ); |
|
| 28 | 28 | parent::setUp(); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -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', $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()); |
|
| 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 | 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 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | */ |
| 30 | 30 | public function setUp() { |
| 31 | - $this->_geocoder = new Geocoder(['api_key' => $this->_api_key]); |
|
| 31 | + $this->_geocoder = new Geocoder( ['api_key' => $this->_api_key] ); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -36,27 +36,27 @@ discard block |
||
| 36 | 36 | * @covers ::api_key |
| 37 | 37 | */ |
| 38 | 38 | public function testConstructorWithAPIKey() { |
| 39 | - $this->assertEquals($this->_api_key, $this->_geocoder->api_key()); |
|
| 39 | + $this->assertEquals( $this->_api_key, $this->_geocoder->api_key() ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @covers ::_make_url |
| 44 | 44 | */ |
| 45 | 45 | public function testMakeUrl() { |
| 46 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '123 Anywhere Street New York 10001'); |
|
| 46 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '123 Anywhere Street New York 10001' ); |
|
| 47 | 47 | |
| 48 | - $this->assertInternalType('string', $response); |
|
| 49 | - $this->assertRegExp('/address\=123\+Anywhere\+Street\+New\+York\+10001/', $response); |
|
| 50 | - $this->assertRegExp("/key={$this->_api_key}/", $response); |
|
| 48 | + $this->assertInternalType( 'string', $response ); |
|
| 49 | + $this->assertRegExp( '/address\=123\+Anywhere\+Street\+New\+York\+10001/', $response ); |
|
| 50 | + $this->assertRegExp( "/key={$this->_api_key}/", $response ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @covers ::_get_data |
| 55 | 55 | */ |
| 56 | 56 | public function testGetDataCache() { |
| 57 | - wp_cache_add( md5(serialize('foo.bar')), 'foobar'); |
|
| 57 | + wp_cache_add( md5( serialize( 'foo.bar' ) ), 'foobar' ); |
|
| 58 | 58 | |
| 59 | - $this->assertEquals('foobar', $this->reflectionMethodInvokeArgs($this->_geocoder, '_get_data', 'foo.bar')); |
|
| 59 | + $this->assertEquals( 'foobar', $this->reflectionMethodInvokeArgs( $this->_geocoder, '_get_data', 'foo.bar' ) ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -64,42 +64,42 @@ discard block |
||
| 64 | 64 | * @covers ::_get_value_from_results |
| 65 | 65 | */ |
| 66 | 66 | public function testMakeLocation() { |
| 67 | - $response = json_decode($this->get_sample_response(), true); |
|
| 67 | + $response = json_decode( $this->get_sample_response(), true ); |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @var Location $location |
| 71 | 71 | */ |
| 72 | - $location = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_location', $response['results'][0] ); |
|
| 72 | + $location = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_location', $response['results'][0] ); |
|
| 73 | 73 | |
| 74 | - $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location); |
|
| 75 | - $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->address()); |
|
| 76 | - $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->formatted_address()); |
|
| 77 | - $this->assertEquals(37.4224764, $location->latitude()); |
|
| 74 | + $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location ); |
|
| 75 | + $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->address() ); |
|
| 76 | + $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->formatted_address() ); |
|
| 77 | + $this->assertEquals( 37.4224764, $location->latitude() ); |
|
| 78 | 78 | $this->assertEquals(-122.0842499, $location->longitude()); |
| 79 | - $this->assertEquals('ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id()); |
|
| 80 | - $this->assertInternalType('array', $location->viewport()); |
|
| 81 | - $this->assertArrayHasKey('northeast', $location->viewport()); |
|
| 82 | - $this->assertArrayHasKey('southwest', $location->viewport()); |
|
| 83 | - $this->assertInternalType('array', $location->viewport()['northeast']); |
|
| 84 | - $this->assertArrayHasKey('lat', $location->viewport()['northeast']); |
|
| 85 | - $this->assertArrayHasKey('lng', $location->viewport()['northeast']); |
|
| 86 | - $this->assertEquals(37.4238253802915, $location->viewport()['northeast']['lat']); |
|
| 79 | + $this->assertEquals( 'ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id() ); |
|
| 80 | + $this->assertInternalType( 'array', $location->viewport() ); |
|
| 81 | + $this->assertArrayHasKey( 'northeast', $location->viewport() ); |
|
| 82 | + $this->assertArrayHasKey( 'southwest', $location->viewport() ); |
|
| 83 | + $this->assertInternalType( 'array', $location->viewport()['northeast'] ); |
|
| 84 | + $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] ); |
|
| 85 | + $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] ); |
|
| 86 | + $this->assertEquals( 37.4238253802915, $location->viewport()['northeast']['lat'] ); |
|
| 87 | 87 | $this->assertEquals(-122.0829009197085, $location->viewport()['northeast']['lng']); |
| 88 | - $this->assertInternalType('array', $location->viewport()['southwest']); |
|
| 89 | - $this->assertArrayHasKey('lat', $location->viewport()['southwest']); |
|
| 90 | - $this->assertArrayHasKey('lng', $location->viewport()['southwest']); |
|
| 91 | - $this->assertEquals(37.4211274197085, $location->viewport()['southwest']['lat']); |
|
| 88 | + $this->assertInternalType( 'array', $location->viewport()['southwest'] ); |
|
| 89 | + $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] ); |
|
| 90 | + $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] ); |
|
| 91 | + $this->assertEquals( 37.4211274197085, $location->viewport()['southwest']['lat'] ); |
|
| 92 | 92 | $this->assertEquals(-122.0855988802915, $location->viewport()['southwest']['lng']); |
| 93 | - $this->assertEquals('CA', $location->state()); |
|
| 94 | - $this->assertEquals('94043', $location->zip_code()); |
|
| 93 | + $this->assertEquals( 'CA', $location->state() ); |
|
| 94 | + $this->assertEquals( '94043', $location->zip_code() ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @covers ::_make_request |
| 99 | 99 | */ |
| 100 | 100 | public function testMakeRequestInvalidURL() { |
| 101 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', 'foo.bar'); |
|
| 102 | - $this->assertInstanceOf('WP_Error', $response); |
|
| 101 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', 'foo.bar' ); |
|
| 102 | + $this->assertInstanceOf( 'WP_Error', $response ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | \ No newline at end of file |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - private $_position = array( 'lat' => 37.4224764, 'lng' => -122.0842499); |
|
| 32 | + private $_position = array( 'lat' => 37.4224764, 'lng' => -122.0842499 ); |
|
| 33 | 33 | |
| 34 | 34 | public function setUp() { |
| 35 | 35 | |
| 36 | 36 | $this->_geocoder = $this->getMockGeocoder(); |
| 37 | 37 | |
| 38 | - $this->_model = new Marker_Model([ |
|
| 38 | + $this->_model = new Marker_Model( [ |
|
| 39 | 39 | 'address' => $this->_address, |
| 40 | 40 | 'geocoder' => $this->_geocoder, |
| 41 | 41 | 'title' => 'Sample Title' |
| 42 | - ]); |
|
| 42 | + ] ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -47,21 +47,21 @@ discard block |
||
| 47 | 47 | * @covers ::latitude |
| 48 | 48 | */ |
| 49 | 49 | public function testLatitude() { |
| 50 | - $this->assertEquals($this->_position['lat'], $this->_model->latitude()); |
|
| 50 | + $this->assertEquals( $this->_position['lat'], $this->_model->latitude() ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @covers ::longitude |
| 55 | 55 | */ |
| 56 | 56 | public function testLongitude() { |
| 57 | - $this->assertEquals($this->_position['lng'], $this->_model->longitude()); |
|
| 57 | + $this->assertEquals( $this->_position['lng'], $this->_model->longitude() ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @covers ::_geocoder |
| 62 | 62 | */ |
| 63 | 63 | public function testGeocoder() { |
| 64 | - $this->assertEquals($this->_geocoder, $this->reflectionMethodInvoke($this->_model, '_geocoder')); |
|
| 64 | + $this->assertEquals( $this->_geocoder, $this->reflectionMethodInvoke( $this->_model, '_geocoder' ) ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -69,32 +69,32 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function testCreateGeocoder() { |
| 71 | 71 | $marker_model = new Marker_Model(); |
| 72 | - $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder', $this->reflectionMethodInvoke($marker_model, '_geocoder')); |
|
| 72 | + $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder', $this->reflectionMethodInvoke( $marker_model, '_geocoder' ) ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @covers ::position |
| 77 | 77 | */ |
| 78 | 78 | public function testPosition() { |
| 79 | - $this->assertEquals($this->_position, $this->_model->position()); |
|
| 79 | + $this->assertEquals( $this->_position, $this->_model->position() ); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * @covers ::title |
| 84 | 84 | */ |
| 85 | 85 | public function testTitle() { |
| 86 | - $this->assertEquals('Sample Title', $this->_model->title()); |
|
| 86 | + $this->assertEquals( 'Sample Title', $this->_model->title() ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function testMarkerArgs() { |
| 90 | 90 | |
| 91 | 91 | $args = $this->_model->marker_args(); |
| 92 | 92 | |
| 93 | - $this->assertInternalType('array', $args); |
|
| 94 | - $this->assertArrayHasKey('position', $args); |
|
| 95 | - $this->assertArrayHasKey('label', $args); |
|
| 96 | - $this->assertArrayHasKey('title', $args); |
|
| 97 | - $this->assertEquals($this->_position, $args['position']); |
|
| 98 | - $this->assertEquals('Sample Title', $args['title']); |
|
| 93 | + $this->assertInternalType( 'array', $args ); |
|
| 94 | + $this->assertArrayHasKey( 'position', $args ); |
|
| 95 | + $this->assertArrayHasKey( 'label', $args ); |
|
| 96 | + $this->assertArrayHasKey( 'title', $args ); |
|
| 97 | + $this->assertEquals( $this->_position, $args['position'] ); |
|
| 98 | + $this->assertEquals( 'Sample Title', $args['title'] ); |
|
| 99 | 99 | } |
| 100 | 100 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function setUp() { |
| 27 | 27 | |
| 28 | - $this->_model = new Map_Model(array('center' => $this->_center, 'markers' => array('foo', 'bar', 'baz'), 'zoom' => 12)); |
|
| 28 | + $this->_model = new Map_Model( array( 'center' => $this->_center, 'markers' => array( 'foo', 'bar', 'baz' ), 'zoom' => 12 ) ); |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function testCenter() { |
| 36 | 36 | |
| 37 | - $this->assertEquals($this->_center, $this->_model->center()); |
|
| 37 | + $this->assertEquals( $this->_center, $this->_model->center() ); |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function testMarkers() { |
| 45 | 45 | |
| 46 | - $this->assertEquals(array('foo','bar','baz'), $this->_model->markers()); |
|
| 46 | + $this->assertEquals( array( 'foo', 'bar', 'baz' ), $this->_model->markers() ); |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function testAddMarker() { |
| 55 | 55 | |
| 56 | - $this->_model->add_marker('foobar'); |
|
| 56 | + $this->_model->add_marker( 'foobar' ); |
|
| 57 | 57 | |
| 58 | - $this->assertContains('foobar', $this->_model->markers()); |
|
| 58 | + $this->assertContains( 'foobar', $this->_model->markers() ); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function testAddMarkers() { |
| 67 | 67 | |
| 68 | - $this->_model->add_markers(array('foobar', 'barbaz')); |
|
| 68 | + $this->_model->add_markers( array( 'foobar', 'barbaz' ) ); |
|
| 69 | 69 | |
| 70 | 70 | $markers = $this->_model->markers(); |
| 71 | 71 | |
| 72 | - $this->assertContains('foobar', $markers); |
|
| 73 | - $this->assertContains('barbaz', $markers); |
|
| 72 | + $this->assertContains( 'foobar', $markers ); |
|
| 73 | + $this->assertContains( 'barbaz', $markers ); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @covers ::zoom |
| 79 | 79 | */ |
| 80 | 80 | public function testZoom() { |
| 81 | - $this->assertEquals(12, $this->_model->zoom()); |
|
| 81 | + $this->assertEquals( 12, $this->_model->zoom() ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $args = $this->_model->make_args(); |
| 90 | 90 | |
| 91 | - $this->assertInternalType('array', $args); |
|
| 92 | - $this->assertArrayHasKey('center', $args); |
|
| 93 | - $this->assertArrayHasKey('zoom', $args); |
|
| 94 | - $this->assertInternalType('array', $args['center']); |
|
| 95 | - $this->assertInternalType('integer', $args['zoom']); |
|
| 96 | - $this->assertArrayHasKey('lat', $args['center']); |
|
| 97 | - $this->assertArrayHasKey('lat', $args['center']); |
|
| 98 | - $this->assertInternalType('float', $args['center']['lat']); |
|
| 99 | - $this->assertInternalType('float', $args['center']['lng']); |
|
| 91 | + $this->assertInternalType( 'array', $args ); |
|
| 92 | + $this->assertArrayHasKey( 'center', $args ); |
|
| 93 | + $this->assertArrayHasKey( 'zoom', $args ); |
|
| 94 | + $this->assertInternalType( 'array', $args['center'] ); |
|
| 95 | + $this->assertInternalType( 'integer', $args['zoom'] ); |
|
| 96 | + $this->assertArrayHasKey( 'lat', $args['center'] ); |
|
| 97 | + $this->assertArrayHasKey( 'lat', $args['center'] ); |
|
| 98 | + $this->assertInternalType( 'float', $args['center']['lat'] ); |
|
| 99 | + $this->assertInternalType( 'float', $args['center']['lng'] ); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function testHeight() { |
| 107 | 107 | |
| 108 | - $this->assertEquals('400px', $this->_model->height()); |
|
| 108 | + $this->assertEquals( '400px', $this->_model->height() ); |
|
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function testWidth() { |
| 116 | 116 | |
| 117 | - $this->assertEquals('100%', $this->_model->width()); |
|
| 117 | + $this->assertEquals( '100%', $this->_model->width() ); |
|
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $id = $this->_model->html_id(); |
| 127 | 127 | |
| 128 | - $this->assertInternalType('string', $id); |
|
| 129 | - $this->assertStringStartsWith('map-', $id); |
|
| 128 | + $this->assertInternalType( 'string', $id ); |
|
| 129 | + $this->assertStringStartsWith( 'map-', $id ); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function setUp() { |
| 22 | 22 | |
| 23 | - $this->_model = new Info_Window_Model(array( |
|
| 23 | + $this->_model = new Info_Window_Model( array( |
|
| 24 | 24 | 'content' => 'Lorem ipsum dolor est.', |
| 25 | 25 | 'pixel_offset' => 20, |
| 26 | - 'position' => array('lat' => 100.946382, 'lng' => -100.9473927), |
|
| 26 | + 'position' => array( 'lat' => 100.946382, 'lng' => -100.9473927 ), |
|
| 27 | 27 | 'max_width' => 500, |
| 28 | 28 | |
| 29 | - )); |
|
| 29 | + ) ); |
|
| 30 | 30 | parent::setUp(); |
| 31 | 31 | |
| 32 | 32 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function testContent() { |
| 38 | 38 | |
| 39 | - $this->assertEquals('Lorem ipsum dolor est.', $this->_model->content()); |
|
| 39 | + $this->assertEquals( 'Lorem ipsum dolor est.', $this->_model->content() ); |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function testPixelOffset() { |
| 47 | 47 | |
| 48 | - $this->assertEquals(20, $this->_model->pixel_offset()); |
|
| 48 | + $this->assertEquals( 20, $this->_model->pixel_offset() ); |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function testPosition() { |
| 56 | 56 | |
| 57 | - $this->assertEquals(array('lat' => 100.946382, 'lng' => -100.9473927), $this->_model->position()); |
|
| 57 | + $this->assertEquals( array( 'lat' => 100.946382, 'lng' => -100.9473927 ), $this->_model->position() ); |
|
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function testMaxWidth() { |
| 65 | 65 | |
| 66 | - $this->assertEquals(500, $this->_model->max_width()); |
|
| 66 | + $this->assertEquals( 500, $this->_model->max_width() ); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | |