|
@@ -2,7 +2,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
} |