@@ -20,38 +20,38 @@ discard block |
||
| 20 | 20 | private $_geocoder; |
| 21 | 21 | |
| 22 | 22 | public function setUp() { |
| 23 | - $this->_geocoder = new Geocoder(['api_key' => '']); |
|
| 23 | + $this->_geocoder = new Geocoder( ['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 | } |
@@ -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 | |