@@ -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 | } |
@@ -15,57 +15,57 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class TestMarker extends TestCase { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var Marker |
|
| 20 | - */ |
|
| 21 | - private $_marker; |
|
| 18 | + /** |
|
| 19 | + * @var Marker |
|
| 20 | + */ |
|
| 21 | + private $_marker; |
|
| 22 | 22 | |
| 23 | - public function setUp() { |
|
| 24 | - $this->_marker = new Marker(array( |
|
| 25 | - 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
|
| 26 | - 'title' => 'Sample Location' |
|
| 27 | - )); |
|
| 28 | - parent::setUp(); |
|
| 29 | - } |
|
| 23 | + public function setUp() { |
|
| 24 | + $this->_marker = new Marker(array( |
|
| 25 | + 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
|
| 26 | + 'title' => 'Sample Location' |
|
| 27 | + )); |
|
| 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', $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 | - } |
|
| 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 | + } |
|
| 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 | } |
@@ -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 | } |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | public function testMakeLocation() { |
| 67 | 67 | $response = json_decode($this->get_sample_response(), true); |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @var Location $location |
|
| 71 | - */ |
|
| 69 | + /** |
|
| 70 | + * @var Location $location |
|
| 71 | + */ |
|
| 72 | 72 | $location = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_location', $response['results'][0] ); |
| 73 | 73 | |
| 74 | 74 | $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | $this->assertArrayHasKey('lng', $location->viewport()['southwest']); |
| 91 | 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 | /** |
@@ -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 |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | private $_geocoder; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var array |
|
| 31 | - */ |
|
| 32 | - private $_position = array( 'lat' => 37.4224764, 'lng' => -122.0842499); |
|
| 29 | + /** |
|
| 30 | + * @var array |
|
| 31 | + */ |
|
| 32 | + private $_position = array( 'lat' => 37.4224764, 'lng' => -122.0842499); |
|
| 33 | 33 | |
| 34 | 34 | public function setUp() { |
| 35 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $this->_model = new Marker_Model([ |
| 39 | 39 | 'address' => $this->_address, |
| 40 | 40 | 'geocoder' => $this->_geocoder, |
| 41 | - 'title' => 'Sample Title' |
|
| 41 | + 'title' => 'Sample Title' |
|
| 42 | 42 | ]); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -72,29 +72,29 @@ discard block |
||
| 72 | 72 | $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder', $this->reflectionMethodInvoke($marker_model, '_geocoder')); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @covers ::position |
|
| 77 | - */ |
|
| 75 | + /** |
|
| 76 | + * @covers ::position |
|
| 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 | - /** |
|
| 83 | - * @covers ::title |
|
| 84 | - */ |
|
| 82 | + /** |
|
| 83 | + * @covers ::title |
|
| 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 | - $args = $this->_model->marker_args(); |
|
| 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 | } |
@@ -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 | } |
@@ -81,52 +81,52 @@ |
||
| 81 | 81 | $this->assertEquals(12, $this->_model->zoom()); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @covers ::make_args |
|
| 86 | - */ |
|
| 84 | + /** |
|
| 85 | + * @covers ::make_args |
|
| 86 | + */ |
|
| 87 | 87 | public function testMakeArgs() { |
| 88 | 88 | |
| 89 | - $args = $this->_model->make_args(); |
|
| 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 | |
| 103 | - /** |
|
| 104 | - * @covers ::height |
|
| 105 | - */ |
|
| 103 | + /** |
|
| 104 | + * @covers ::height |
|
| 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 | |
| 112 | - /** |
|
| 113 | - * @covers ::width |
|
| 114 | - */ |
|
| 112 | + /** |
|
| 113 | + * @covers ::width |
|
| 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 | |
| 121 | - /** |
|
| 122 | - * @covers ::html_id |
|
| 123 | - */ |
|
| 121 | + /** |
|
| 122 | + * @covers ::html_id |
|
| 123 | + */ |
|
| 124 | 124 | public function testHtmlId() { |
| 125 | 125 | |
| 126 | - $id = $this->_model->html_id(); |
|
| 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 | |
@@ -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 | |
@@ -13,58 +13,58 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class TestInfoWindowModel extends TestCase { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @var Info_Window_Model |
|
| 18 | - */ |
|
| 19 | - private $_model; |
|
| 16 | + /** |
|
| 17 | + * @var Info_Window_Model |
|
| 18 | + */ |
|
| 19 | + private $_model; |
|
| 20 | 20 | |
| 21 | - public function setUp() { |
|
| 21 | + public function setUp() { |
|
| 22 | 22 | |
| 23 | - $this->_model = new Info_Window_Model(array( |
|
| 24 | - 'content' => 'Lorem ipsum dolor est.', |
|
| 25 | - 'pixel_offset' => 20, |
|
| 26 | - 'position' => array('lat' => 100.946382, 'lng' => -100.9473927), |
|
| 27 | - 'max_width' => 500, |
|
| 23 | + $this->_model = new Info_Window_Model(array( |
|
| 24 | + 'content' => 'Lorem ipsum dolor est.', |
|
| 25 | + 'pixel_offset' => 20, |
|
| 26 | + 'position' => array('lat' => 100.946382, 'lng' => -100.9473927), |
|
| 27 | + 'max_width' => 500, |
|
| 28 | 28 | |
| 29 | - )); |
|
| 30 | - parent::setUp(); |
|
| 29 | + )); |
|
| 30 | + parent::setUp(); |
|
| 31 | 31 | |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @covers ::content |
|
| 36 | - */ |
|
| 37 | - public function testContent() { |
|
| 34 | + /** |
|
| 35 | + * @covers ::content |
|
| 36 | + */ |
|
| 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 | |
| 43 | - /** |
|
| 44 | - * @covers ::pixel_offset |
|
| 45 | - */ |
|
| 46 | - public function testPixelOffset() { |
|
| 43 | + /** |
|
| 44 | + * @covers ::pixel_offset |
|
| 45 | + */ |
|
| 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 | |
| 52 | - /** |
|
| 53 | - * @covers ::position |
|
| 54 | - */ |
|
| 55 | - public function testPosition() { |
|
| 52 | + /** |
|
| 53 | + * @covers ::position |
|
| 54 | + */ |
|
| 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 | |
| 61 | - /** |
|
| 62 | - * @covers ::max_width |
|
| 63 | - */ |
|
| 64 | - public function testMaxWidth() { |
|
| 61 | + /** |
|
| 62 | + * @covers ::max_width |
|
| 63 | + */ |
|
| 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 | |
| 70 | 70 | } |
@@ -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 | |
@@ -16,61 +16,61 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class testMarkerLabelModel extends TestCase { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var Marker_Label_Model |
|
| 21 | - */ |
|
| 22 | - private $_model; |
|
| 23 | - |
|
| 24 | - public function setUp() { |
|
| 25 | - |
|
| 26 | - $this->_model = new Marker_Label_Model(); |
|
| 27 | - parent::setUp(); |
|
| 28 | - |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @covers ::color |
|
| 33 | - * @covers ::font_family |
|
| 34 | - * @covers ::font_size |
|
| 35 | - * @covers ::font_weight |
|
| 36 | - * @covers ::text |
|
| 37 | - */ |
|
| 38 | - public function testDefaults() { |
|
| 39 | - |
|
| 40 | - |
|
| 41 | - $this->assertEquals('black', $this->_model->color()); |
|
| 42 | - $this->assertInternalType('string', $this->_model->font_family()); |
|
| 43 | - $this->assertEmpty($this->_model->font_family()); |
|
| 44 | - $this->assertEquals('14px', $this->_model->font_size()); |
|
| 45 | - $this->assertEquals('400', $this->_model->font_weight()); |
|
| 46 | - $this->assertInternalType('string', $this->_model->text()); |
|
| 47 | - $this->assertEmpty($this->_model->text()); |
|
| 48 | - |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * @covers ::color |
|
| 53 | - * @covers ::font_family |
|
| 54 | - * @covers ::font_size |
|
| 55 | - * @covers ::font_weight |
|
| 56 | - * @covers ::text |
|
| 57 | - */ |
|
| 58 | - public function testPassedArguments() { |
|
| 59 | - |
|
| 60 | - $model = new Marker_Label_Model(array( |
|
| 61 | - 'color' => 'blue', |
|
| 62 | - 'font_family' => 'Arial', |
|
| 63 | - 'font_size' => '22px', |
|
| 64 | - 'font_weight' => 900, |
|
| 65 | - 'text' => 'Lorem ipsum dolor est', |
|
| 66 | - )); |
|
| 67 | - |
|
| 68 | - $this->assertEquals('blue', $model->color()); |
|
| 69 | - $this->assertEquals('Arial', $model->font_family()); |
|
| 70 | - $this->assertEquals('22px', $model->font_size()); |
|
| 71 | - $this->assertEquals('900', $model->font_weight()); |
|
| 72 | - $this->assertEquals('Lorem ipsum dolor est', $model->text()); |
|
| 73 | - |
|
| 74 | - } |
|
| 19 | + /** |
|
| 20 | + * @var Marker_Label_Model |
|
| 21 | + */ |
|
| 22 | + private $_model; |
|
| 23 | + |
|
| 24 | + public function setUp() { |
|
| 25 | + |
|
| 26 | + $this->_model = new Marker_Label_Model(); |
|
| 27 | + parent::setUp(); |
|
| 28 | + |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @covers ::color |
|
| 33 | + * @covers ::font_family |
|
| 34 | + * @covers ::font_size |
|
| 35 | + * @covers ::font_weight |
|
| 36 | + * @covers ::text |
|
| 37 | + */ |
|
| 38 | + public function testDefaults() { |
|
| 39 | + |
|
| 40 | + |
|
| 41 | + $this->assertEquals('black', $this->_model->color()); |
|
| 42 | + $this->assertInternalType('string', $this->_model->font_family()); |
|
| 43 | + $this->assertEmpty($this->_model->font_family()); |
|
| 44 | + $this->assertEquals('14px', $this->_model->font_size()); |
|
| 45 | + $this->assertEquals('400', $this->_model->font_weight()); |
|
| 46 | + $this->assertInternalType('string', $this->_model->text()); |
|
| 47 | + $this->assertEmpty($this->_model->text()); |
|
| 48 | + |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @covers ::color |
|
| 53 | + * @covers ::font_family |
|
| 54 | + * @covers ::font_size |
|
| 55 | + * @covers ::font_weight |
|
| 56 | + * @covers ::text |
|
| 57 | + */ |
|
| 58 | + public function testPassedArguments() { |
|
| 59 | + |
|
| 60 | + $model = new Marker_Label_Model(array( |
|
| 61 | + 'color' => 'blue', |
|
| 62 | + 'font_family' => 'Arial', |
|
| 63 | + 'font_size' => '22px', |
|
| 64 | + 'font_weight' => 900, |
|
| 65 | + 'text' => 'Lorem ipsum dolor est', |
|
| 66 | + )); |
|
| 67 | + |
|
| 68 | + $this->assertEquals('blue', $model->color()); |
|
| 69 | + $this->assertEquals('Arial', $model->font_family()); |
|
| 70 | + $this->assertEquals('22px', $model->font_size()); |
|
| 71 | + $this->assertEquals('900', $model->font_weight()); |
|
| 72 | + $this->assertEquals('Lorem ipsum dolor est', $model->text()); |
|
| 73 | + |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | } |
| 77 | 77 | \ No newline at end of file |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | public function testDefaults() { |
| 39 | 39 | |
| 40 | 40 | |
| 41 | - $this->assertEquals('black', $this->_model->color()); |
|
| 42 | - $this->assertInternalType('string', $this->_model->font_family()); |
|
| 43 | - $this->assertEmpty($this->_model->font_family()); |
|
| 44 | - $this->assertEquals('14px', $this->_model->font_size()); |
|
| 45 | - $this->assertEquals('400', $this->_model->font_weight()); |
|
| 46 | - $this->assertInternalType('string', $this->_model->text()); |
|
| 47 | - $this->assertEmpty($this->_model->text()); |
|
| 41 | + $this->assertEquals( 'black', $this->_model->color() ); |
|
| 42 | + $this->assertInternalType( 'string', $this->_model->font_family() ); |
|
| 43 | + $this->assertEmpty( $this->_model->font_family() ); |
|
| 44 | + $this->assertEquals( '14px', $this->_model->font_size() ); |
|
| 45 | + $this->assertEquals( '400', $this->_model->font_weight() ); |
|
| 46 | + $this->assertInternalType( 'string', $this->_model->text() ); |
|
| 47 | + $this->assertEmpty( $this->_model->text() ); |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
@@ -57,19 +57,19 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function testPassedArguments() { |
| 59 | 59 | |
| 60 | - $model = new Marker_Label_Model(array( |
|
| 60 | + $model = new Marker_Label_Model( array( |
|
| 61 | 61 | 'color' => 'blue', |
| 62 | 62 | 'font_family' => 'Arial', |
| 63 | 63 | 'font_size' => '22px', |
| 64 | 64 | 'font_weight' => 900, |
| 65 | 65 | 'text' => 'Lorem ipsum dolor est', |
| 66 | - )); |
|
| 66 | + ) ); |
|
| 67 | 67 | |
| 68 | - $this->assertEquals('blue', $model->color()); |
|
| 69 | - $this->assertEquals('Arial', $model->font_family()); |
|
| 70 | - $this->assertEquals('22px', $model->font_size()); |
|
| 71 | - $this->assertEquals('900', $model->font_weight()); |
|
| 72 | - $this->assertEquals('Lorem ipsum dolor est', $model->text()); |
|
| 68 | + $this->assertEquals( 'blue', $model->color() ); |
|
| 69 | + $this->assertEquals( 'Arial', $model->font_family() ); |
|
| 70 | + $this->assertEquals( '22px', $model->font_size() ); |
|
| 71 | + $this->assertEquals( '900', $model->font_weight() ); |
|
| 72 | + $this->assertEquals( 'Lorem ipsum dolor est', $model->text() ); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
@@ -63,11 +63,11 @@ |
||
| 63 | 63 | 'longitude' => null, |
| 64 | 64 | ) ); |
| 65 | 65 | |
| 66 | - if ( empty( $args['info_window'] ) ) { |
|
| 67 | - $args['info_window'] = new Info_Window( array( |
|
| 68 | - 'position' => array( 'lat' => $args['latitude'], 'lng' => $args['longitude'] ), |
|
| 69 | - ) ); |
|
| 70 | - } |
|
| 66 | + if ( empty( $args['info_window'] ) ) { |
|
| 67 | + $args['info_window'] = new Info_Window( array( |
|
| 68 | + 'position' => array( 'lat' => $args['latitude'], 'lng' => $args['longitude'] ), |
|
| 69 | + ) ); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | parent::__construct( $args ); |
| 73 | 73 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'longitude' => null, |
| 64 | 64 | ) ); |
| 65 | 65 | |
| 66 | - if ( empty( $args['info_window'] ) ) { |
|
| 66 | + if ( empty($args['info_window']) ) { |
|
| 67 | 67 | $args['info_window'] = new Info_Window( array( |
| 68 | 68 | 'position' => array( 'lat' => $args['latitude'], 'lng' => $args['longitude'] ), |
| 69 | 69 | ) ); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function latitude() { |
| 102 | 102 | |
| 103 | - if ( is_null( $this->_latitude ) && ! is_wp_error( $this->location() ) ) { |
|
| 103 | + if ( is_null( $this->_latitude ) && !is_wp_error( $this->location() ) ) { |
|
| 104 | 104 | $this->_latitude = $this->location()->latitude(); |
| 105 | 105 | } |
| 106 | 106 | return doubleval( $this->_latitude ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @return Location|\WP_Error |
| 111 | 111 | */ |
| 112 | 112 | function location() { |
| 113 | - if ( ! is_object( $this->_location ) ) { |
|
| 113 | + if ( !is_object( $this->_location ) ) { |
|
| 114 | 114 | $this->_location = $this->_geocoder()->geocode( $this->_address ); |
| 115 | 115 | } |
| 116 | 116 | return $this->_location; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | function longitude() { |
| 123 | 123 | |
| 124 | - if ( is_null( $this->_longitude ) && ! is_wp_error( $this->location() ) ) { |
|
| 124 | + if ( is_null( $this->_longitude ) && !is_wp_error( $this->location() ) ) { |
|
| 125 | 125 | $this->_longitude = doubleval( $this->location()->longitude() ); |
| 126 | 126 | } |
| 127 | 127 | return doubleval( $this->_longitude ); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @return Geocoder |
| 168 | 168 | */ |
| 169 | 169 | private function _geocoder() { |
| 170 | - if (! is_a( $this->_geocoder, '\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder' ) ) { |
|
| 170 | + if ( !is_a( $this->_geocoder, '\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder' ) ) { |
|
| 171 | 171 | $this->_geocoder = new Geocoder(); |
| 172 | 172 | } |
| 173 | 173 | |