@@ -20,38 +20,38 @@ discard block |
||
| 20 | 20 | private $_geocoder; |
| 21 | 21 | |
| 22 | 22 | public function setUp() { |
| 23 | - $this->_geocoder = new Geocoder(['api_key' => getenv('MAPS_API_KEY')]); |
|
| 23 | + $this->_geocoder = new Geocoder( ['api_key' => getenv( 'MAPS_API_KEY' )] ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @covers ::_make_request |
| 28 | 28 | */ |
| 29 | 29 | public function testMakeRequest() { |
| 30 | - $url = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA'); |
|
| 31 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', $url); |
|
| 30 | + $url = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA' ); |
|
| 31 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', $url ); |
|
| 32 | 32 | |
| 33 | - $this->assertInternalType('array', $response); |
|
| 33 | + $this->assertInternalType( 'array', $response ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @covers ::_make_request |
| 38 | 38 | */ |
| 39 | 39 | public function testMakeRequestError404() { |
| 40 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', 'https://maps.googleapis.com/maps/api/geo'); |
|
| 40 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', 'https://maps.googleapis.com/maps/api/geo' ); |
|
| 41 | 41 | |
| 42 | - $this->assertInstanceOf('WP_Error', $response); |
|
| 43 | - $this->assertObjectHasAttribute('errors', $response); |
|
| 44 | - $this->assertArrayHasKey('404', $response->errors); |
|
| 42 | + $this->assertInstanceOf( 'WP_Error', $response ); |
|
| 43 | + $this->assertObjectHasAttribute( 'errors', $response ); |
|
| 44 | + $this->assertArrayHasKey( '404', $response->errors ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @covers ::_get_data |
| 49 | 49 | */ |
| 50 | 50 | public function testGetData() { |
| 51 | - $url = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA'); |
|
| 52 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_get_data', $url); |
|
| 51 | + $url = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA' ); |
|
| 52 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_get_data', $url ); |
|
| 53 | 53 | |
| 54 | - $this->assertInternalType('array', $response); |
|
| 54 | + $this->assertInternalType( 'array', $response ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -59,25 +59,25 @@ discard block |
||
| 59 | 59 | * @covers ::_make_location |
| 60 | 60 | */ |
| 61 | 61 | public function testGeocode() { |
| 62 | - $location = $this->_geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA'); |
|
| 62 | + $location = $this->_geocoder->geocode( '1600 Amphitheatre Parkway, Mountain View, CA' ); |
|
| 63 | 63 | |
| 64 | - $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location); |
|
| 65 | - $this->assertInternalType('string', $location->address()); |
|
| 66 | - $this->assertInternalType('string', $location->formatted_address()); |
|
| 67 | - $this->assertInternalType('double', $location->latitude()); |
|
| 68 | - $this->assertInternalType('double', $location->longitude()); |
|
| 69 | - $this->assertInternalType('array', $location->viewport()); |
|
| 70 | - $this->assertArrayHasKey('northeast', $location->viewport()); |
|
| 71 | - $this->assertArrayHasKey('southwest', $location->viewport()); |
|
| 72 | - $this->assertInternalType('array', $location->viewport()['northeast']); |
|
| 73 | - $this->assertArrayHasKey('lat', $location->viewport()['northeast']); |
|
| 74 | - $this->assertArrayHasKey('lng', $location->viewport()['northeast']); |
|
| 75 | - $this->assertInternalType('double', $location->viewport()['northeast']['lat']); |
|
| 76 | - $this->assertInternalType('double', $location->viewport()['northeast']['lng']); |
|
| 77 | - $this->assertInternalType('array', $location->viewport()['southwest']); |
|
| 78 | - $this->assertArrayHasKey('lat', $location->viewport()['southwest']); |
|
| 79 | - $this->assertArrayHasKey('lng', $location->viewport()['southwest']); |
|
| 80 | - $this->assertInternalType('double', $location->viewport()['southwest']['lat']); |
|
| 81 | - $this->assertInternalType('double', $location->viewport()['southwest']['lng']); |
|
| 64 | + $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location ); |
|
| 65 | + $this->assertInternalType( 'string', $location->address() ); |
|
| 66 | + $this->assertInternalType( 'string', $location->formatted_address() ); |
|
| 67 | + $this->assertInternalType( 'double', $location->latitude() ); |
|
| 68 | + $this->assertInternalType( 'double', $location->longitude() ); |
|
| 69 | + $this->assertInternalType( 'array', $location->viewport() ); |
|
| 70 | + $this->assertArrayHasKey( 'northeast', $location->viewport() ); |
|
| 71 | + $this->assertArrayHasKey( 'southwest', $location->viewport() ); |
|
| 72 | + $this->assertInternalType( 'array', $location->viewport()['northeast'] ); |
|
| 73 | + $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] ); |
|
| 74 | + $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] ); |
|
| 75 | + $this->assertInternalType( 'double', $location->viewport()['northeast']['lat'] ); |
|
| 76 | + $this->assertInternalType( 'double', $location->viewport()['northeast']['lng'] ); |
|
| 77 | + $this->assertInternalType( 'array', $location->viewport()['southwest'] ); |
|
| 78 | + $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] ); |
|
| 79 | + $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] ); |
|
| 80 | + $this->assertInternalType( 'double', $location->viewport()['southwest']['lat'] ); |
|
| 81 | + $this->assertInternalType( 'double', $location->viewport()['southwest']['lng'] ); |
|
| 82 | 82 | } |
| 83 | 83 | } |
@@ -118,16 +118,16 @@ |
||
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * @return array |
|
| 123 | - */ |
|
| 124 | - function make_args() { |
|
| 121 | + /** |
|
| 122 | + * @return array |
|
| 123 | + */ |
|
| 124 | + function make_args() { |
|
| 125 | 125 | |
| 126 | - return array( |
|
| 127 | - 'center' => $this->center(), |
|
| 128 | - 'zoom' => (int)$this->zoom() |
|
| 129 | - ); |
|
| 126 | + return array( |
|
| 127 | + 'center' => $this->center(), |
|
| 128 | + 'zoom' => (int)$this->zoom() |
|
| 129 | + ); |
|
| 130 | 130 | |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | 133 | } |
@@ -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'; |
|
@@ -14,24 +14,24 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class TestGoogleMaps extends TestCase { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @covers ::_wp_enqueue_scripts_9 |
|
| 19 | - */ |
|
| 20 | - function testScriptRegistered() { |
|
| 21 | - $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
| 22 | - $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @covers ::_wp_enqueue_scripts_9 |
|
| 27 | - * @depends testScriptRegistered |
|
| 28 | - */ |
|
| 29 | - function testScriptEnqueued() { |
|
| 30 | - |
|
| 31 | - Google_Maps::register_script_condition(function(){return true;}); |
|
| 32 | - |
|
| 33 | - $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
| 34 | - $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
| 35 | - |
|
| 36 | - } |
|
| 17 | + /** |
|
| 18 | + * @covers ::_wp_enqueue_scripts_9 |
|
| 19 | + */ |
|
| 20 | + function testScriptRegistered() { |
|
| 21 | + $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
| 22 | + $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @covers ::_wp_enqueue_scripts_9 |
|
| 27 | + * @depends testScriptRegistered |
|
| 28 | + */ |
|
| 29 | + function testScriptEnqueued() { |
|
| 30 | + |
|
| 31 | + Google_Maps::register_script_condition(function(){return true;}); |
|
| 32 | + |
|
| 33 | + $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
| 34 | + $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
| 35 | + |
|
| 36 | + } |
|
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -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 |
@@ -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 | |