@@ -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(); |
@@ -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 |
@@ -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 | } |
@@ -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 |
@@ -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 | } |
@@ -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 |
@@ -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 | /** |
@@ -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 | } |
@@ -19,19 +19,19 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Marker_Label extends \WPLib_Item_Base { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Marker_Label constructor. |
|
| 24 | - * |
|
| 25 | - * @param array $args |
|
| 26 | - */ |
|
| 27 | - function __construct( $args = array() ) { |
|
| 22 | + /** |
|
| 23 | + * Marker_Label constructor. |
|
| 24 | + * |
|
| 25 | + * @param array $args |
|
| 26 | + */ |
|
| 27 | + function __construct( $args = array() ) { |
|
| 28 | 28 | |
| 29 | - $temp = wp_parse_args( $args, array( |
|
| 30 | - 'label' => new \Clubdeuce\WPGoogleMaps\Marker_Label( $args ), |
|
| 31 | - ) ); |
|
| 29 | + $temp = wp_parse_args( $args, array( |
|
| 30 | + 'label' => new \Clubdeuce\WPGoogleMaps\Marker_Label( $args ), |
|
| 31 | + ) ); |
|
| 32 | 32 | |
| 33 | - parent::__construct( $temp ); |
|
| 33 | + parent::__construct( $temp ); |
|
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |