@@ -42,7 +42,7 @@ |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * @param $address |
|
45 | + * @param string $address |
|
46 | 46 | * @param array $args |
47 | 47 | * |
48 | 48 | * @return Marker |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | |
15 | 15 | const INSTANCE_CLASS = 'Clubdeuce\WPLib\Components\GoogleMaps\Map'; |
16 | 16 | |
17 | - /** |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - protected static $_version = '0.1.6'; |
|
21 | - |
|
22 | - /** |
|
23 | - * |
|
24 | - */ |
|
17 | + /** |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + protected static $_version = '0.1.6'; |
|
21 | + |
|
22 | + /** |
|
23 | + * |
|
24 | + */ |
|
25 | 25 | static function on_load() { |
26 | 26 | |
27 | - require_once 'vendor/autoload.php'; |
|
27 | + require_once 'vendor/autoload.php'; |
|
28 | 28 | self::register_helper( '\Clubdeuce\WPGoogleMaps\Google_Maps', __CLASS__ ); |
29 | - \Clubdeuce\WPGoogleMaps\Google_Maps::initialize(); |
|
29 | + \Clubdeuce\WPGoogleMaps\Google_Maps::initialize(); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
@@ -41,32 +41,32 @@ discard block |
||
41 | 41 | |
42 | 42 | } |
43 | 43 | |
44 | - /** |
|
45 | - * @param $address |
|
46 | - * @param array $args |
|
47 | - * |
|
48 | - * @return Marker |
|
49 | - */ |
|
44 | + /** |
|
45 | + * @param $address |
|
46 | + * @param array $args |
|
47 | + * |
|
48 | + * @return Marker |
|
49 | + */ |
|
50 | 50 | static function make_marker_by_address( $address, $args = array() ) { |
51 | 51 | |
52 | - $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_address( $address, $args ); |
|
53 | - return new Marker( array( 'marker' => $marker ), $args ); |
|
52 | + $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_address( $address, $args ); |
|
53 | + return new Marker( array( 'marker' => $marker ), $args ); |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * @param float $lat |
|
59 | - * @param float $lng |
|
60 | - * @param array $args |
|
61 | - * |
|
62 | - * @return Marker |
|
63 | - */ |
|
64 | - static function make_marker_by_position( $lat, $lng, $args = array() ) { |
|
57 | + /** |
|
58 | + * @param float $lat |
|
59 | + * @param float $lng |
|
60 | + * @param array $args |
|
61 | + * |
|
62 | + * @return Marker |
|
63 | + */ |
|
64 | + static function make_marker_by_position( $lat, $lng, $args = array() ) { |
|
65 | 65 | |
66 | - $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_position( $lat, $lng, $args ); |
|
67 | - return new Marker( array( 'marker' => $marker ), $args ); |
|
66 | + $marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_position( $lat, $lng, $args ); |
|
67 | + return new Marker( array( 'marker' => $marker ), $args ); |
|
68 | 68 | |
69 | - } |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | Google_Maps::on_load(); |
@@ -1,21 +1,21 @@ |
||
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 | -if ( ! function_exists( 'wplib_define' ) ) { |
|
12 | - require( VENDOR_DIRECTORY . '/wplib/wplib/defines.php' ); |
|
11 | +if ( !function_exists( 'wplib_define' ) ) { |
|
12 | + require(VENDOR_DIRECTORY.'/wplib/wplib/defines.php'); |
|
13 | 13 | wplib_define( 'WPLib_Runmode', 'PRODUCTION' ); |
14 | 14 | wplib_define( 'WPLib_Stability', 'EXPERIMENTAL' ); |
15 | 15 | } |
16 | -require_once VENDOR_DIRECTORY . '/autoload.php'; |
|
16 | +require_once VENDOR_DIRECTORY.'/autoload.php'; |
|
17 | 17 | |
18 | -require_once VENDOR_DIRECTORY . '/wplib/wplib/wplib.php'; |
|
18 | +require_once VENDOR_DIRECTORY.'/wplib/wplib/wplib.php'; |
|
19 | 19 | WPLib::initialize(); |
20 | 20 | |
21 | 21 | \Clubdeuce\WPLib\Components\Google_Maps::initialize(); |
@@ -15,48 +15,48 @@ |
||
15 | 15 | */ |
16 | 16 | class testGoogleMaps extends TestCase { |
17 | 17 | |
18 | - /** |
|
19 | - * @covers ::on_load |
|
20 | - */ |
|
21 | - public function testAutoloadWorks() { |
|
18 | + /** |
|
19 | + * @covers ::on_load |
|
20 | + */ |
|
21 | + public function testAutoloadWorks() { |
|
22 | 22 | |
23 | - Google_Maps::on_load(); |
|
24 | - $this->assertTrue(class_exists(GM::class)); |
|
23 | + Google_Maps::on_load(); |
|
24 | + $this->assertTrue(class_exists(GM::class)); |
|
25 | 25 | |
26 | - } |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @covers ::make_new_map |
|
30 | - */ |
|
31 | - public function testMakeNewMapReturnsMyMap() { |
|
28 | + /** |
|
29 | + * @covers ::make_new_map |
|
30 | + */ |
|
31 | + public function testMakeNewMapReturnsMyMap() { |
|
32 | 32 | |
33 | - $map = Google_Maps::make_new_map(array( |
|
34 | - 'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35 | - )); |
|
33 | + $map = Google_Maps::make_new_map(array( |
|
34 | + 'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35 | + )); |
|
36 | 36 | |
37 | - $this->assertInstanceOf(Map::class, $map); |
|
37 | + $this->assertInstanceOf(Map::class, $map); |
|
38 | 38 | |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * @covers ::make_marker_by_address |
|
43 | - */ |
|
44 | - public function testMakeMarkerByAddress() { |
|
41 | + /** |
|
42 | + * @covers ::make_marker_by_address |
|
43 | + */ |
|
44 | + public function testMakeMarkerByAddress() { |
|
45 | 45 | |
46 | - $marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
46 | + $marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
47 | 47 | |
48 | - $this->assertInstanceOf(Marker::class, $marker); |
|
48 | + $this->assertInstanceOf(Marker::class, $marker); |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @covers ::make_marker_by_position |
|
54 | - */ |
|
55 | - public function testMakeMarkerByPosition() { |
|
52 | + /** |
|
53 | + * @covers ::make_marker_by_position |
|
54 | + */ |
|
55 | + public function testMakeMarkerByPosition() { |
|
56 | 56 | |
57 | - $marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
57 | + $marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
58 | 58 | |
59 | - $this->assertInstanceOf(Marker::class, $marker); |
|
59 | + $this->assertInstanceOf(Marker::class, $marker); |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function testAutoloadWorks() { |
22 | 22 | |
23 | 23 | Google_Maps::on_load(); |
24 | - $this->assertTrue(class_exists(GM::class)); |
|
24 | + $this->assertTrue( class_exists( GM::class ) ); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function testMakeNewMapReturnsMyMap() { |
32 | 32 | |
33 | - $map = Google_Maps::make_new_map(array( |
|
34 | - 'center' => array('lat' => 123.45, 'lng' => '-123.45') |
|
35 | - )); |
|
33 | + $map = Google_Maps::make_new_map( array( |
|
34 | + 'center' => array( 'lat' => 123.45, 'lng' => '-123.45' ) |
|
35 | + ) ); |
|
36 | 36 | |
37 | - $this->assertInstanceOf(Map::class, $map); |
|
37 | + $this->assertInstanceOf( Map::class, $map ); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function testMakeMarkerByAddress() { |
45 | 45 | |
46 | - $marker = Google_Maps::make_marker_by_address('1600 Pennsylvania Avenue NW Washington DC'); |
|
46 | + $marker = Google_Maps::make_marker_by_address( '1600 Pennsylvania Avenue NW Washington DC' ); |
|
47 | 47 | |
48 | - $this->assertInstanceOf(Marker::class, $marker); |
|
48 | + $this->assertInstanceOf( Marker::class, $marker ); |
|
49 | 49 | |
50 | 50 | } |
51 | 51 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function testMakeMarkerByPosition() { |
56 | 56 | |
57 | - $marker = Google_Maps::make_marker_by_position(123.45, -123.45); |
|
57 | + $marker = Google_Maps::make_marker_by_position( 123.45, -123.45 ); |
|
58 | 58 | |
59 | - $this->assertInstanceOf(Marker::class, $marker); |
|
59 | + $this->assertInstanceOf( Marker::class, $marker ); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | } |
63 | 63 | \ No newline at end of file |
@@ -14,61 +14,61 @@ |
||
14 | 14 | */ |
15 | 15 | class TestInfoWindowModel extends TestCase { |
16 | 16 | |
17 | - /** |
|
18 | - * @var Info_Window_Model |
|
19 | - */ |
|
20 | - private $_model; |
|
17 | + /** |
|
18 | + * @var Info_Window_Model |
|
19 | + */ |
|
20 | + private $_model; |
|
21 | 21 | |
22 | - public function setUp() { |
|
22 | + public function setUp() { |
|
23 | 23 | |
24 | - $this->_model = new Info_Window_Model(array('info_window' => self::_get_mock_info_window())); |
|
25 | - parent::setUp(); |
|
26 | - } |
|
24 | + $this->_model = new Info_Window_Model(array('info_window' => self::_get_mock_info_window())); |
|
25 | + parent::setUp(); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @covers ::__construct |
|
30 | - * @covers ::__call |
|
31 | - */ |
|
32 | - public function testInfoWindowIsSet() { |
|
33 | - $this->assertEquals(self::_get_mock_info_window(), $this->_model->info_window()); |
|
34 | - } |
|
28 | + /** |
|
29 | + * @covers ::__construct |
|
30 | + * @covers ::__call |
|
31 | + */ |
|
32 | + public function testInfoWindowIsSet() { |
|
33 | + $this->assertEquals(self::_get_mock_info_window(), $this->_model->info_window()); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @covers ::has_info_window |
|
38 | - */ |
|
39 | - public function testHasInfoWindow() { |
|
40 | - $this->assertTrue($this->_model->has_info_window()); |
|
41 | - } |
|
36 | + /** |
|
37 | + * @covers ::has_info_window |
|
38 | + */ |
|
39 | + public function testHasInfoWindow() { |
|
40 | + $this->assertTrue($this->_model->has_info_window()); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @covers ::__call |
|
45 | - */ |
|
46 | - public function testMagicMethods() { |
|
47 | - $this->assertEquals('Sample Info Window Content', $this->_model->content()); |
|
48 | - $this->assertEquals('12', $this->_model->pixel_offset()); |
|
49 | - $this->assertEquals(array('lat' => 123.45, 'lng' => -123.45), $this->_model->position()); |
|
50 | - $this->assertEquals('450px', $this->_model->max_width()); |
|
51 | - } |
|
43 | + /** |
|
44 | + * @covers ::__call |
|
45 | + */ |
|
46 | + public function testMagicMethods() { |
|
47 | + $this->assertEquals('Sample Info Window Content', $this->_model->content()); |
|
48 | + $this->assertEquals('12', $this->_model->pixel_offset()); |
|
49 | + $this->assertEquals(array('lat' => 123.45, 'lng' => -123.45), $this->_model->position()); |
|
50 | + $this->assertEquals('450px', $this->_model->max_width()); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @covers ::__call |
|
55 | - */ |
|
56 | - public function testMagicMethodNull() { |
|
57 | - $window = new Info_Window_Model(array('info_window' => null)); |
|
53 | + /** |
|
54 | + * @covers ::__call |
|
55 | + */ |
|
56 | + public function testMagicMethodNull() { |
|
57 | + $window = new Info_Window_Model(array('info_window' => null)); |
|
58 | 58 | |
59 | - $this->assertNull($window->content()); |
|
60 | - } |
|
59 | + $this->assertNull($window->content()); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return \Mockery\MockInterface |
|
64 | - */ |
|
65 | - private function _get_mock_info_window() { |
|
66 | - $mock = \Mockery::mock(MIW::class); |
|
67 | - $mock->shouldReceive('content')->andReturn('Sample Info Window Content'); |
|
68 | - $mock->shouldReceive('pixel_offset')->andReturn(12); |
|
69 | - $mock->shouldReceive('position')->andReturn(array('lat' => 123.45, 'lng' => -123.45)); |
|
70 | - $mock->shouldReceive('max_width')->andReturn('450px'); |
|
62 | + /** |
|
63 | + * @return \Mockery\MockInterface |
|
64 | + */ |
|
65 | + private function _get_mock_info_window() { |
|
66 | + $mock = \Mockery::mock(MIW::class); |
|
67 | + $mock->shouldReceive('content')->andReturn('Sample Info Window Content'); |
|
68 | + $mock->shouldReceive('pixel_offset')->andReturn(12); |
|
69 | + $mock->shouldReceive('position')->andReturn(array('lat' => 123.45, 'lng' => -123.45)); |
|
70 | + $mock->shouldReceive('max_width')->andReturn('450px'); |
|
71 | 71 | |
72 | - return $mock; |
|
73 | - } |
|
72 | + return $mock; |
|
73 | + } |
|
74 | 74 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function setUp() { |
23 | 23 | |
24 | - $this->_model = new Info_Window_Model(array('info_window' => self::_get_mock_info_window())); |
|
24 | + $this->_model = new Info_Window_Model( array( 'info_window' => self::_get_mock_info_window() ) ); |
|
25 | 25 | parent::setUp(); |
26 | 26 | } |
27 | 27 | |
@@ -30,44 +30,44 @@ discard block |
||
30 | 30 | * @covers ::__call |
31 | 31 | */ |
32 | 32 | public function testInfoWindowIsSet() { |
33 | - $this->assertEquals(self::_get_mock_info_window(), $this->_model->info_window()); |
|
33 | + $this->assertEquals( self::_get_mock_info_window(), $this->_model->info_window() ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @covers ::has_info_window |
38 | 38 | */ |
39 | 39 | public function testHasInfoWindow() { |
40 | - $this->assertTrue($this->_model->has_info_window()); |
|
40 | + $this->assertTrue( $this->_model->has_info_window() ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @covers ::__call |
45 | 45 | */ |
46 | 46 | public function testMagicMethods() { |
47 | - $this->assertEquals('Sample Info Window Content', $this->_model->content()); |
|
48 | - $this->assertEquals('12', $this->_model->pixel_offset()); |
|
49 | - $this->assertEquals(array('lat' => 123.45, 'lng' => -123.45), $this->_model->position()); |
|
50 | - $this->assertEquals('450px', $this->_model->max_width()); |
|
47 | + $this->assertEquals( 'Sample Info Window Content', $this->_model->content() ); |
|
48 | + $this->assertEquals( '12', $this->_model->pixel_offset() ); |
|
49 | + $this->assertEquals( array( 'lat' => 123.45, 'lng' => -123.45 ), $this->_model->position() ); |
|
50 | + $this->assertEquals( '450px', $this->_model->max_width() ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @covers ::__call |
55 | 55 | */ |
56 | 56 | public function testMagicMethodNull() { |
57 | - $window = new Info_Window_Model(array('info_window' => null)); |
|
57 | + $window = new Info_Window_Model( array( 'info_window' => null ) ); |
|
58 | 58 | |
59 | - $this->assertNull($window->content()); |
|
59 | + $this->assertNull( $window->content() ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return \Mockery\MockInterface |
64 | 64 | */ |
65 | 65 | private function _get_mock_info_window() { |
66 | - $mock = \Mockery::mock(MIW::class); |
|
67 | - $mock->shouldReceive('content')->andReturn('Sample Info Window Content'); |
|
68 | - $mock->shouldReceive('pixel_offset')->andReturn(12); |
|
69 | - $mock->shouldReceive('position')->andReturn(array('lat' => 123.45, 'lng' => -123.45)); |
|
70 | - $mock->shouldReceive('max_width')->andReturn('450px'); |
|
66 | + $mock = \Mockery::mock( MIW::class ); |
|
67 | + $mock->shouldReceive( 'content' )->andReturn( 'Sample Info Window Content' ); |
|
68 | + $mock->shouldReceive( 'pixel_offset' )->andReturn( 12 ); |
|
69 | + $mock->shouldReceive( 'position' )->andReturn( array( 'lat' => 123.45, 'lng' => -123.45 ) ); |
|
70 | + $mock->shouldReceive( 'max_width' )->andReturn( '450px' ); |
|
71 | 71 | |
72 | 72 | return $mock; |
73 | 73 | } |
@@ -15,65 +15,65 @@ |
||
15 | 15 | */ |
16 | 16 | class TestLocationModel extends TestCase { |
17 | 17 | |
18 | - /** |
|
19 | - * @var Location_Model |
|
20 | - */ |
|
21 | - private $_location; |
|
18 | + /** |
|
19 | + * @var Location_Model |
|
20 | + */ |
|
21 | + private $_location; |
|
22 | 22 | |
23 | - public function setUp() { |
|
24 | - $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
|
25 | - parent::setUp(); |
|
26 | - } |
|
23 | + public function setUp() { |
|
24 | + $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
|
25 | + parent::setUp(); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @covers ::__construct |
|
30 | - * @covers ::__call |
|
31 | - */ |
|
32 | - public function testConstruct() { |
|
33 | - $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
|
34 | - } |
|
28 | + /** |
|
29 | + * @covers ::__construct |
|
30 | + * @covers ::__call |
|
31 | + */ |
|
32 | + public function testConstruct() { |
|
33 | + $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @covers ::__construct |
|
38 | - * @covers ::__call |
|
39 | - */ |
|
40 | - public function testConstructDefaults() { |
|
41 | - $location = new Location_Model(); |
|
42 | - $this->assertTrue($location->has_location()); |
|
43 | - $this->assertInstanceOf(Loc::class, $location->location()); |
|
44 | - } |
|
36 | + /** |
|
37 | + * @covers ::__construct |
|
38 | + * @covers ::__call |
|
39 | + */ |
|
40 | + public function testConstructDefaults() { |
|
41 | + $location = new Location_Model(); |
|
42 | + $this->assertTrue($location->has_location()); |
|
43 | + $this->assertInstanceOf(Loc::class, $location->location()); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @covers ::__construct |
|
48 | - * @covers ::has_location |
|
49 | - */ |
|
50 | - public function testHasLocation() { |
|
51 | - $this->assertTrue($this->_location->has_location()); |
|
52 | - } |
|
46 | + /** |
|
47 | + * @covers ::__construct |
|
48 | + * @covers ::has_location |
|
49 | + */ |
|
50 | + public function testHasLocation() { |
|
51 | + $this->assertTrue($this->_location->has_location()); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @covers ::__call |
|
56 | - */ |
|
57 | - public function testMagicMethodCall() { |
|
58 | - $this->assertEquals('bar', $this->_location->foo()); |
|
59 | - } |
|
54 | + /** |
|
55 | + * @covers ::__call |
|
56 | + */ |
|
57 | + public function testMagicMethodCall() { |
|
58 | + $this->assertEquals('bar', $this->_location->foo()); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @covers ::__call |
|
63 | - */ |
|
64 | - public function testMagicMethodCallNull() { |
|
65 | - $location = new Location_Model(array('location' => null)); |
|
66 | - $this->assertNull($location->latitude()); |
|
67 | - } |
|
61 | + /** |
|
62 | + * @covers ::__call |
|
63 | + */ |
|
64 | + public function testMagicMethodCallNull() { |
|
65 | + $location = new Location_Model(array('location' => null)); |
|
66 | + $this->assertNull($location->latitude()); |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return \Mockery\MockInterface |
|
71 | - */ |
|
72 | - private function _getMockLocation() { |
|
73 | - $location = \Mockery::mock(MLoc::class); |
|
69 | + /** |
|
70 | + * @return \Mockery\MockInterface |
|
71 | + */ |
|
72 | + private function _getMockLocation() { |
|
73 | + $location = \Mockery::mock(MLoc::class); |
|
74 | 74 | |
75 | - $location->shouldReceive('foo')->andReturn('bar'); |
|
75 | + $location->shouldReceive('foo')->andReturn('bar'); |
|
76 | 76 | |
77 | - return $location; |
|
78 | - } |
|
77 | + return $location; |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | private $_location; |
22 | 22 | |
23 | 23 | public function setUp() { |
24 | - $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
|
24 | + $this->_location = new Location_Model( array( 'location' => $this->_getMockLocation() ) ); |
|
25 | 25 | parent::setUp(); |
26 | 26 | } |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @covers ::__call |
31 | 31 | */ |
32 | 32 | public function testConstruct() { |
33 | - $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
|
33 | + $this->assertEquals( self::_getMockLocation(), $this->_location->location() ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function testConstructDefaults() { |
41 | 41 | $location = new Location_Model(); |
42 | - $this->assertTrue($location->has_location()); |
|
43 | - $this->assertInstanceOf(Loc::class, $location->location()); |
|
42 | + $this->assertTrue( $location->has_location() ); |
|
43 | + $this->assertInstanceOf( Loc::class, $location->location() ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,31 +48,31 @@ discard block |
||
48 | 48 | * @covers ::has_location |
49 | 49 | */ |
50 | 50 | public function testHasLocation() { |
51 | - $this->assertTrue($this->_location->has_location()); |
|
51 | + $this->assertTrue( $this->_location->has_location() ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @covers ::__call |
56 | 56 | */ |
57 | 57 | public function testMagicMethodCall() { |
58 | - $this->assertEquals('bar', $this->_location->foo()); |
|
58 | + $this->assertEquals( 'bar', $this->_location->foo() ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @covers ::__call |
63 | 63 | */ |
64 | 64 | public function testMagicMethodCallNull() { |
65 | - $location = new Location_Model(array('location' => null)); |
|
66 | - $this->assertNull($location->latitude()); |
|
65 | + $location = new Location_Model( array( 'location' => null ) ); |
|
66 | + $this->assertNull( $location->latitude() ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @return \Mockery\MockInterface |
71 | 71 | */ |
72 | 72 | private function _getMockLocation() { |
73 | - $location = \Mockery::mock(MLoc::class); |
|
73 | + $location = \Mockery::mock( MLoc::class ); |
|
74 | 74 | |
75 | - $location->shouldReceive('foo')->andReturn('bar'); |
|
75 | + $location->shouldReceive( 'foo' )->andReturn( 'bar' ); |
|
76 | 76 | |
77 | 77 | return $location; |
78 | 78 | } |
@@ -14,58 +14,58 @@ |
||
14 | 14 | */ |
15 | 15 | class TestMarker extends TestCase { |
16 | 16 | |
17 | - /** |
|
18 | - * @var Marker |
|
19 | - */ |
|
20 | - private $_marker; |
|
17 | + /** |
|
18 | + * @var Marker |
|
19 | + */ |
|
20 | + private $_marker; |
|
21 | 21 | |
22 | - public function setUp() { |
|
23 | - $this->_marker = new Marker(array( |
|
24 | - 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
|
25 | - 'title' => 'Sample Location' |
|
26 | - )); |
|
22 | + public function setUp() { |
|
23 | + $this->_marker = new Marker(array( |
|
24 | + 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
|
25 | + 'title' => 'Sample Location' |
|
26 | + )); |
|
27 | 27 | |
28 | - parent::setUp(); |
|
29 | - } |
|
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', $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', $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 | } |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | private $_marker; |
21 | 21 | |
22 | 22 | public function setUp() { |
23 | - $this->_marker = new Marker(array( |
|
23 | + $this->_marker = new Marker( array( |
|
24 | 24 | 'address' => '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', |
25 | 25 | 'title' => 'Sample Location' |
26 | - )); |
|
26 | + ) ); |
|
27 | 27 | |
28 | 28 | parent::setUp(); |
29 | 29 | } |
@@ -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', $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', $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 | } |
@@ -14,27 +14,27 @@ |
||
14 | 14 | */ |
15 | 15 | class TestGoogleMaps extends TestCase { |
16 | 16 | |
17 | - public function setUp() { |
|
18 | - Google_Maps::register_script_condition(true); |
|
19 | - wp_enqueue_scripts(); |
|
20 | - } |
|
21 | - |
|
22 | - /** |
|
23 | - * @coversNothing |
|
24 | - */ |
|
25 | - function testScriptRegistered() { |
|
26 | - $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
27 | - $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
28 | - } |
|
29 | - |
|
30 | - /** |
|
31 | - * @coversNothing |
|
32 | - * @depends testScriptRegistered |
|
33 | - */ |
|
34 | - function testScriptEnqueued() { |
|
35 | - |
|
36 | - $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
37 | - $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
38 | - |
|
39 | - } |
|
17 | + public function setUp() { |
|
18 | + Google_Maps::register_script_condition(true); |
|
19 | + wp_enqueue_scripts(); |
|
20 | + } |
|
21 | + |
|
22 | + /** |
|
23 | + * @coversNothing |
|
24 | + */ |
|
25 | + function testScriptRegistered() { |
|
26 | + $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
27 | + $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
28 | + } |
|
29 | + |
|
30 | + /** |
|
31 | + * @coversNothing |
|
32 | + * @depends testScriptRegistered |
|
33 | + */ |
|
34 | + function testScriptEnqueued() { |
|
35 | + |
|
36 | + $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
37 | + $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
38 | + |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | class TestGoogleMaps extends TestCase { |
16 | 16 | |
17 | 17 | public function setUp() { |
18 | - Google_Maps::register_script_condition(true); |
|
18 | + Google_Maps::register_script_condition( true ); |
|
19 | 19 | wp_enqueue_scripts(); |
20 | 20 | } |
21 | 21 | |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @coversNothing |
24 | 24 | */ |
25 | 25 | function testScriptRegistered() { |
26 | - $this->assertTrue(wp_script_is('google-maps', 'registered')); |
|
27 | - $this->assertTrue(wp_script_is('map-control', 'registered')); |
|
26 | + $this->assertTrue( wp_script_is( 'google-maps', 'registered' ) ); |
|
27 | + $this->assertTrue( wp_script_is( 'map-control', 'registered' ) ); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function testScriptEnqueued() { |
35 | 35 | |
36 | - $this->assertTrue(wp_script_is('google-maps', 'enqueued')); |
|
37 | - $this->assertTrue(wp_script_is('map-control', 'enqueued')); |
|
36 | + $this->assertTrue( wp_script_is( 'google-maps', 'enqueued' ) ); |
|
37 | + $this->assertTrue( wp_script_is( 'map-control', 'enqueued' ) ); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function setUp() { |
22 | 22 | $this->_geocoder = new Geocoder(array('api_key' => getenv('MAPS_API_KEY'))); |
23 | - parent::setUp(); |
|
23 | + parent::setUp(); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | private $_geocoder; |
20 | 20 | |
21 | 21 | public function setUp() { |
22 | - $this->_geocoder = new Geocoder(array('api_key' => getenv('MAPS_API_KEY'))); |
|
22 | + $this->_geocoder = new Geocoder( array( 'api_key' => getenv( 'MAPS_API_KEY' ) ) ); |
|
23 | 23 | parent::setUp(); |
24 | 24 | } |
25 | 25 | |
@@ -27,26 +27,26 @@ discard block |
||
27 | 27 | * @covers ::geocode |
28 | 28 | */ |
29 | 29 | public function testGeocode() { |
30 | - $location = $this->_geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA'); |
|
31 | - |
|
32 | - $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location); |
|
33 | - $this->assertInternalType('string', $location->address()); |
|
34 | - $this->assertInternalType('string', $location->formatted_address()); |
|
35 | - $this->assertInternalType('double', $location->latitude()); |
|
36 | - $this->assertInternalType('double', $location->longitude()); |
|
37 | - $this->assertInternalType('array', $location->viewport()); |
|
38 | - $this->assertArrayHasKey('northeast', $location->viewport()); |
|
39 | - $this->assertArrayHasKey('southwest', $location->viewport()); |
|
40 | - $this->assertInternalType('array', $location->viewport()['northeast']); |
|
41 | - $this->assertArrayHasKey('lat', $location->viewport()['northeast']); |
|
42 | - $this->assertArrayHasKey('lng', $location->viewport()['northeast']); |
|
43 | - $this->assertInternalType('double', $location->viewport()['northeast']['lat']); |
|
44 | - $this->assertInternalType('double', $location->viewport()['northeast']['lng']); |
|
45 | - $this->assertInternalType('array', $location->viewport()['southwest']); |
|
46 | - $this->assertArrayHasKey('lat', $location->viewport()['southwest']); |
|
47 | - $this->assertArrayHasKey('lng', $location->viewport()['southwest']); |
|
48 | - $this->assertInternalType('double', $location->viewport()['southwest']['lat']); |
|
49 | - $this->assertInternalType('double', $location->viewport()['southwest']['lng']); |
|
30 | + $location = $this->_geocoder->geocode( '1600 Amphitheatre Parkway, Mountain View, CA' ); |
|
31 | + |
|
32 | + $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location ); |
|
33 | + $this->assertInternalType( 'string', $location->address() ); |
|
34 | + $this->assertInternalType( 'string', $location->formatted_address() ); |
|
35 | + $this->assertInternalType( 'double', $location->latitude() ); |
|
36 | + $this->assertInternalType( 'double', $location->longitude() ); |
|
37 | + $this->assertInternalType( 'array', $location->viewport() ); |
|
38 | + $this->assertArrayHasKey( 'northeast', $location->viewport() ); |
|
39 | + $this->assertArrayHasKey( 'southwest', $location->viewport() ); |
|
40 | + $this->assertInternalType( 'array', $location->viewport()['northeast'] ); |
|
41 | + $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] ); |
|
42 | + $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] ); |
|
43 | + $this->assertInternalType( 'double', $location->viewport()['northeast']['lat'] ); |
|
44 | + $this->assertInternalType( 'double', $location->viewport()['northeast']['lng'] ); |
|
45 | + $this->assertInternalType( 'array', $location->viewport()['southwest'] ); |
|
46 | + $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] ); |
|
47 | + $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] ); |
|
48 | + $this->assertInternalType( 'double', $location->viewport()['southwest']['lat'] ); |
|
49 | + $this->assertInternalType( 'double', $location->viewport()['southwest']['lng'] ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
@@ -24,29 +24,29 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $_location; |
26 | 26 | |
27 | - /** |
|
28 | - * Location_Model constructor. |
|
29 | - * |
|
30 | - * @param array $args |
|
31 | - */ |
|
32 | - function __construct( $args = array() ) { |
|
27 | + /** |
|
28 | + * Location_Model constructor. |
|
29 | + * |
|
30 | + * @param array $args |
|
31 | + */ |
|
32 | + function __construct( $args = array() ) { |
|
33 | 33 | |
34 | - $args = wp_parse_args( $args, array( |
|
35 | - 'location' => new Location( $args ), |
|
36 | - ) ); |
|
34 | + $args = wp_parse_args( $args, array( |
|
35 | + 'location' => new Location( $args ), |
|
36 | + ) ); |
|
37 | 37 | |
38 | - parent::__construct( $args ); |
|
38 | + parent::__construct( $args ); |
|
39 | 39 | |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return bool |
|
44 | - */ |
|
45 | - function has_location() { |
|
42 | + /** |
|
43 | + * @return bool |
|
44 | + */ |
|
45 | + function has_location() { |
|
46 | 46 | |
47 | - return $this->_has( '_location' ); |
|
47 | + return $this->_has( '_location' ); |
|
48 | 48 | |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param string $method_name |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | public function __call( $method_name, $args ) { |
56 | 56 | $value = null; |
57 | 57 | |
58 | - do { |
|
58 | + do { |
|
59 | 59 | |
60 | - if ( property_exists( $this, "_{$method_name}" ) ) { |
|
61 | - $property = "_{$method_name}"; |
|
62 | - $value = $this->{$property}; |
|
63 | - break; |
|
64 | - } |
|
60 | + if ( property_exists( $this, "_{$method_name}" ) ) { |
|
61 | + $property = "_{$method_name}"; |
|
62 | + $value = $this->{$property}; |
|
63 | + break; |
|
64 | + } |
|
65 | 65 | |
66 | - if ( ! isset( $this->_location ) ) { |
|
67 | - break; |
|
68 | - } |
|
66 | + if ( ! isset( $this->_location ) ) { |
|
67 | + break; |
|
68 | + } |
|
69 | 69 | |
70 | - $value = call_user_func_array( array( $this->_location, $method_name ), $args ); |
|
70 | + $value = call_user_func_array( array( $this->_location, $method_name ), $args ); |
|
71 | 71 | |
72 | - } while ( false ); |
|
72 | + } while ( false ); |
|
73 | 73 | |
74 | 74 | return $value; |
75 | 75 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | break; |
64 | 64 | } |
65 | 65 | |
66 | - if ( ! isset( $this->_location ) ) { |
|
66 | + if ( !isset($this->_location) ) { |
|
67 | 67 | break; |
68 | 68 | } |
69 | 69 |