@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Clubdeuce\WPLib\Components\GoogleMaps\Tests\UnitTests; |
| 4 | 4 | |
| 5 | -require_once dirname( dirname(__DIR__) ) . '/component-google-maps.php'; |
|
| 5 | +require_once dirname( dirname( __DIR__ ) ).'/component-google-maps.php'; |
|
| 6 | 6 | |
| 7 | 7 | use Clubdeuce\WPLib\Components\Google_Maps; |
| 8 | 8 | use Clubdeuce\WPLib\Components\GoogleMaps\Marker; |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function testApiKeySetAndGet() { |
| 23 | 23 | |
| 24 | - Google_Maps::register_api_key('foo'); |
|
| 25 | - $this->assertEquals('foo', Google_Maps::api_key()); |
|
| 24 | + Google_Maps::register_api_key( 'foo' ); |
|
| 25 | + $this->assertEquals( 'foo', Google_Maps::api_key() ); |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | 28 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function testGeocoder() { |
| 33 | 33 | |
| 34 | - $this->assertInstanceOf('Clubdeuce\WPLib\Components\GoogleMaps\Geocoder', Google_Maps::geocoder()); |
|
| 34 | + $this->assertInstanceOf( 'Clubdeuce\WPLib\Components\GoogleMaps\Geocoder', Google_Maps::geocoder() ); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $map = Google_Maps::make_new_map(); |
| 44 | 44 | |
| 45 | - $this->assertInstanceOf('Clubdeuce\WPLib\Components\GoogleMaps\Map', $map); |
|
| 45 | + $this->assertInstanceOf( 'Clubdeuce\WPLib\Components\GoogleMaps\Map', $map ); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $conditions = Google_Maps::script_conditions(); |
| 58 | 58 | |
| 59 | - $this->assertInternalType('array', $conditions); |
|
| 60 | - $this->assertContains('is_search', $conditions); |
|
| 59 | + $this->assertInternalType( 'array', $conditions ); |
|
| 60 | + $this->assertContains( 'is_search', $conditions ); |
|
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function testMakeMarkerByAddress() { |
| 68 | 68 | |
| 69 | - $marker = Google_Maps::make_marker_by_address('1600 Amphitheatre Way'); |
|
| 69 | + $marker = Google_Maps::make_marker_by_address( '1600 Amphitheatre Way' ); |
|
| 70 | 70 | |
| 71 | - $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Marker', $marker); |
|
| 71 | + $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Marker', $marker ); |
|
| 72 | 72 | |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function testDrivingDirectionsHref() { |
| 79 | 79 | |
| 80 | - $href = Google_Maps::driving_directions_href('1600 Amphitheatre Way'); |
|
| 80 | + $href = Google_Maps::driving_directions_href( '1600 Amphitheatre Way' ); |
|
| 81 | 81 | |
| 82 | - $this->assertRegExp('#^https:\/\/maps\.google\.com\/maps\?saddr=My\+Location&daddr=1600\+Amphitheatre\+Way#', $href); |
|
| 82 | + $this->assertRegExp( '#^https:\/\/maps\.google\.com\/maps\?saddr=My\+Location&daddr=1600\+Amphitheatre\+Way#', $href ); |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function testDrivingDirectionsWithStartAddress() { |
| 90 | 90 | |
| 91 | - $href = Google_Maps::driving_directions_href('1600 Amphitheatre Way', array( 'start' => '1600 Pennsylvania Avenue')); |
|
| 91 | + $href = Google_Maps::driving_directions_href( '1600 Amphitheatre Way', array( 'start' => '1600 Pennsylvania Avenue' ) ); |
|
| 92 | 92 | |
| 93 | - $this->assertRegExp('#^https:\/\/maps\.google\.com\/maps\?saddr=1600\+Pennsylvania\+Avenue&daddr=1600\+Amphitheatre\+Way#', $href); |
|
| 93 | + $this->assertRegExp( '#^https:\/\/maps\.google\.com\/maps\?saddr=1600\+Pennsylvania\+Avenue&daddr=1600\+Amphitheatre\+Way#', $href ); |
|
| 94 | 94 | |
| 95 | 95 | } |
| 96 | 96 | |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function testEvaluateCondition() { |
| 101 | 101 | |
| 102 | - $this->assertTrue($this->reflectionMethodInvokeArgs('\Clubdeuce\WPLib\Components\Google_Maps', '_evaluate_condition', function(){return true;})); |
|
| 103 | - $this->assertFalse($this->reflectionMethodInvokeArgs('\Clubdeuce\WPLib\Components\Google_Maps', '_evaluate_condition', 'foo')); |
|
| 102 | + $this->assertTrue( $this->reflectionMethodInvokeArgs( '\Clubdeuce\WPLib\Components\Google_Maps', '_evaluate_condition', function() {return true; }) ); |
|
| 103 | + $this->assertFalse( $this->reflectionMethodInvokeArgs( '\Clubdeuce\WPLib\Components\Google_Maps', '_evaluate_condition', 'foo' ) ); |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | Google_Maps::_wp_enqueue_scripts_9(); |
| 113 | 113 | |
| 114 | - $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
| 115 | - $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
| 114 | + $this->assertTrue( wp_script_is( 'google-maps', 'registered' ) ); |
|
| 115 | + $this->assertTrue( wp_script_is( 'map-control', 'registered' ) ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function testWpEnqueueScripts9Enqueue() { |
| 122 | 122 | |
| 123 | - Google_Maps::register_script_condition(function(){return true;}); |
|
| 123 | + Google_Maps::register_script_condition( function() {return true; }); |
|
| 124 | 124 | Google_Maps::_wp_enqueue_scripts_9(); |
| 125 | 125 | |
| 126 | - $this->assertTrue(wp_script_is('jquery', 'enqueued')); |
|
| 127 | - $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
| 128 | - $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
| 126 | + $this->assertTrue( wp_script_is( 'jquery', 'enqueued' ) ); |
|
| 127 | + $this->assertTrue( wp_script_is( 'google-maps', 'enqueued' ) ); |
|
| 128 | + $this->assertTrue( wp_script_is( 'map-control', 'enqueued' ) ); |
|
| 129 | 129 | } |
| 130 | 130 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * @param $class |
|
| 37 | - * @param $method |
|
| 36 | + * @param \Clubdeuce\WPLib\Components\GoogleMaps\Marker_Model $class |
|
| 37 | + * @param string $method |
|
| 38 | 38 | * @return mixed |
| 39 | 39 | */ |
| 40 | 40 | public function reflectionMethodInvoke( $class, $method ) |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @param $class |
| 52 | - * @param $method |
|
| 52 | + * @param string $method |
|
| 53 | 53 | * @param $args |
| 54 | 54 | * @return mixed |
| 55 | 55 | */ |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $reflection = new \ReflectionMethod( $class, $method ); |
| 43 | 43 | $reflection->setAccessible( true ); |
| 44 | - if (is_string($class)) { |
|
| 44 | + if ( is_string( $class ) ) { |
|
| 45 | 45 | $class = null; |
| 46 | 46 | } |
| 47 | 47 | return $reflection->invoke( $class ); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $reflection = new \ReflectionMethod( $class, $method ); |
| 59 | 59 | $reflection->setAccessible( true ); |
| 60 | - if (is_string($class)) { |
|
| 60 | + if ( is_string( $class ) ) { |
|
| 61 | 61 | $class = null; |
| 62 | 62 | } |
| 63 | 63 | return $reflection->invoke( $class, $args ); |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | static function geocoder() { |
| 63 | 63 | |
| 64 | - if ( ! isset( static::$_geocoder ) ) { |
|
| 65 | - static::$_geocoder = new Geocoder( ['api_key' => self::api_key() ] ); |
|
| 64 | + if ( !isset(static::$_geocoder) ) { |
|
| 65 | + static::$_geocoder = new Geocoder( ['api_key' => self::api_key()] ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return static::$_geocoder; |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | $source = sprintf( '%1$s/assets/maps.js', self::source_url() ); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - wp_register_script('google-maps', "https://maps.google.com/maps/api/js?v=3&key={$key}", false, '3.0', true ); |
|
| 111 | - wp_register_script('map-control', $source, array( 'jquery', 'google-maps' ), '0.1.2', true ); |
|
| 110 | + wp_register_script( 'google-maps', "https://maps.google.com/maps/api/js?v=3&key={$key}", false, '3.0', true ); |
|
| 111 | + wp_register_script( 'map-control', $source, array( 'jquery', 'google-maps' ), '0.1.2', true ); |
|
| 112 | 112 | |
| 113 | 113 | $conditions = array_map( array( __CLASS__, '_evaluate_condition' ), static::$_script_conditions ); |
| 114 | 114 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param array $args |
| 145 | 145 | * @return string |
| 146 | 146 | */ |
| 147 | - static function driving_directions_href($destination, $args = array() ) { |
|
| 147 | + static function driving_directions_href( $destination, $args = array() ) { |
|
| 148 | 148 | |
| 149 | 149 | $args = wp_parse_args( $args, array( |
| 150 | 150 | 'start' => 'My Location', |
@@ -7,48 +7,48 @@ |
||
| 7 | 7 | class RoboFile extends \Robo\Tasks |
| 8 | 8 | { |
| 9 | 9 | // define public methods as commands |
| 10 | - function tests() |
|
| 11 | - { |
|
| 12 | - |
|
| 13 | - $this->taskExec('mysql -e "CREATE DATABASE IF NOT EXISTS test_db"')->run(); |
|
| 14 | - $this->taskExec('mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"')->run(); |
|
| 15 | - $this->taskSvnStack() |
|
| 16 | - ->checkout('https://develop.svn.wordpress.org/tags/4.8.3 wp-tests') |
|
| 17 | - ->run(); |
|
| 18 | - |
|
| 19 | - $this->setTestConfig(); |
|
| 20 | - $this->phpunit(); |
|
| 21 | - |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - function phpunit() |
|
| 25 | - { |
|
| 26 | - $this->taskPhpUnit('vendor/bin/phpunit') |
|
| 27 | - ->configFile('tests/phpunit.xml.dist') |
|
| 28 | - ->run(); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - private function setTestConfig() |
|
| 32 | - { |
|
| 33 | - |
|
| 34 | - if (file_exists('wp-tests/wp-tests-config-sample.php')) { |
|
| 35 | - copy('wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php'); |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 39 | - ->from('youremptytestdbnamehere') |
|
| 40 | - ->to('test_db') |
|
| 41 | - ->run(); |
|
| 42 | - |
|
| 43 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 44 | - ->from('yourusernamehere') |
|
| 45 | - ->to('root') |
|
| 46 | - ->run(); |
|
| 47 | - |
|
| 48 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 49 | - ->from('yourpasswordhere') |
|
| 50 | - ->to('') |
|
| 51 | - ->run(); |
|
| 52 | - } |
|
| 10 | + function tests() |
|
| 11 | + { |
|
| 12 | + |
|
| 13 | + $this->taskExec('mysql -e "CREATE DATABASE IF NOT EXISTS test_db"')->run(); |
|
| 14 | + $this->taskExec('mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"')->run(); |
|
| 15 | + $this->taskSvnStack() |
|
| 16 | + ->checkout('https://develop.svn.wordpress.org/tags/4.8.3 wp-tests') |
|
| 17 | + ->run(); |
|
| 18 | + |
|
| 19 | + $this->setTestConfig(); |
|
| 20 | + $this->phpunit(); |
|
| 21 | + |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + function phpunit() |
|
| 25 | + { |
|
| 26 | + $this->taskPhpUnit('vendor/bin/phpunit') |
|
| 27 | + ->configFile('tests/phpunit.xml.dist') |
|
| 28 | + ->run(); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + private function setTestConfig() |
|
| 32 | + { |
|
| 33 | + |
|
| 34 | + if (file_exists('wp-tests/wp-tests-config-sample.php')) { |
|
| 35 | + copy('wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php'); |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 39 | + ->from('youremptytestdbnamehere') |
|
| 40 | + ->to('test_db') |
|
| 41 | + ->run(); |
|
| 42 | + |
|
| 43 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 44 | + ->from('yourusernamehere') |
|
| 45 | + ->to('root') |
|
| 46 | + ->run(); |
|
| 47 | + |
|
| 48 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 49 | + ->from('yourpasswordhere') |
|
| 50 | + ->to('') |
|
| 51 | + ->run(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | function tests() |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - $this->taskExec('mysql -e "CREATE DATABASE IF NOT EXISTS test_db"')->run(); |
|
| 14 | - $this->taskExec('mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"')->run(); |
|
| 13 | + $this->taskExec( 'mysql -e "CREATE DATABASE IF NOT EXISTS test_db"' )->run(); |
|
| 14 | + $this->taskExec( 'mysql -e "GRANT ALL ON test_db.* to \'root\'@\'%\'"' )->run(); |
|
| 15 | 15 | $this->taskSvnStack() |
| 16 | - ->checkout('https://develop.svn.wordpress.org/tags/4.8.3 wp-tests') |
|
| 16 | + ->checkout( 'https://develop.svn.wordpress.org/tags/4.8.3 wp-tests' ) |
|
| 17 | 17 | ->run(); |
| 18 | 18 | |
| 19 | 19 | $this->setTestConfig(); |
@@ -23,31 +23,31 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function phpunit() |
| 25 | 25 | { |
| 26 | - $this->taskPhpUnit('vendor/bin/phpunit') |
|
| 27 | - ->configFile('tests/phpunit.xml.dist') |
|
| 26 | + $this->taskPhpUnit( 'vendor/bin/phpunit' ) |
|
| 27 | + ->configFile( 'tests/phpunit.xml.dist' ) |
|
| 28 | 28 | ->run(); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | private function setTestConfig() |
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - if (file_exists('wp-tests/wp-tests-config-sample.php')) { |
|
| 35 | - copy('wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php'); |
|
| 34 | + if ( file_exists( 'wp-tests/wp-tests-config-sample.php' ) ) { |
|
| 35 | + copy( 'wp-tests/wp-tests-config-sample.php', 'wp-tests/wp-tests-config.php' ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 39 | - ->from('youremptytestdbnamehere') |
|
| 40 | - ->to('test_db') |
|
| 38 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php' ) |
|
| 39 | + ->from( 'youremptytestdbnamehere' ) |
|
| 40 | + ->to( 'test_db' ) |
|
| 41 | 41 | ->run(); |
| 42 | 42 | |
| 43 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 44 | - ->from('yourusernamehere') |
|
| 45 | - ->to('root') |
|
| 43 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php' ) |
|
| 44 | + ->from( 'yourusernamehere' ) |
|
| 45 | + ->to( 'root' ) |
|
| 46 | 46 | ->run(); |
| 47 | 47 | |
| 48 | - $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php') |
|
| 49 | - ->from('yourpasswordhere') |
|
| 50 | - ->to('') |
|
| 48 | + $this->taskReplaceInFile( 'wp-tests/wp-tests-config.php' ) |
|
| 49 | + ->from( 'yourpasswordhere' ) |
|
| 50 | + ->to( '' ) |
|
| 51 | 51 | ->run(); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -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 | } |
@@ -81,22 +81,22 @@ |
||
| 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(); |
|
| 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']); |
|
| 89 | + $args = $this->_model->make_args(); |
|
| 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']); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -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 | } |