17
17
use Illuminate \Support \Collection ;
18
18
19
19
/**
20
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
21
+ * @SuppressWarnings(PHPMD.TooManyMethods)
20
22
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
21
23
*/
22
24
class GeocoderServiceTest extends TestCase
@@ -30,12 +32,8 @@ public function setUp()
30
32
31
33
public function testItReverseGeocodesCoordinates ()
32
34
{
33
- // Arrange
34
-
35
- // Act
36
35
$ results = app ('geocoder ' )->reverse (38.8791981 , -76.9818437 )->get ();
37
36
38
- // Assert
39
37
$ this ->assertEquals ('1600 ' , $ results ->first ()->getStreetNumber ());
40
38
$ this ->assertEquals ('Pennsylvania Avenue Southeast ' , $ results ->first ()->getStreetName ());
41
39
$ this ->assertEquals ('Washington ' , $ results ->first ()->getLocality ());
@@ -45,15 +43,11 @@ public function testItReverseGeocodesCoordinates()
45
43
46
44
public function testItResolvesAGivenAddress ()
47
45
{
48
- // Arrange
49
-
50
- // Act
51
46
$ results = app ('geocoder ' )
52
47
->using ('chain ' )
53
48
->geocode ('1600 Pennsylvania Ave., Washington, DC USA ' )
54
49
->get ();
55
50
56
- // Assert
57
51
$ this ->assertEquals ('1600 ' , $ results ->first ()->getStreetNumber ());
58
52
$ this ->assertEquals ('Pennsylvania Avenue Northwest ' , $ results ->first ()->getStreetName ());
59
53
$ this ->assertEquals ('Washington ' , $ results ->first ()->getLocality ());
@@ -63,28 +57,20 @@ public function testItResolvesAGivenAddress()
63
57
64
58
public function testItResolvesAGivenIPAddress ()
65
59
{
66
- // Arrange
67
-
68
- // Act
69
60
$ results = app ('geocoder ' )
70
61
->geocode ('72.229.28.185 ' )
71
62
->get ();
72
63
73
- // Assert
74
64
$ this ->assertTrue ($ results ->isNotEmpty ());
75
65
$ this ->assertEquals ('US ' , $ results ->first ()->getCountry ()->getCode ());
76
66
}
77
67
78
68
public function testItResolvesAGivenAddressWithUmlauts ()
79
69
{
80
- // Arrange
81
-
82
- // Act
83
70
$ results = app ('geocoder ' )
84
71
->geocode ('Obere Donaustrasse 22, Wien, Österreich ' )
85
72
->get ();
86
73
87
- // Assert
88
74
$ this ->assertEquals ('22 ' , $ results ->first ()->getStreetNumber ());
89
75
$ this ->assertEquals ('Obere Donaustraße ' , $ results ->first ()->getStreetName ());
90
76
$ this ->assertEquals ('Wien ' , $ results ->first ()->getLocality ());
@@ -94,19 +80,16 @@ public function testItResolvesAGivenAddressWithUmlauts()
94
80
95
81
public function testItResolvesAGivenAddressWithUmlautsInRegion ()
96
82
{
97
- // Arrange
98
83
config ()->set ('geocoder.providers.Geocoder\Provider\Chain\Chain.Geocoder\Provider\GoogleMaps\GoogleMaps ' , [
99
84
'de-DE ' ,
100
85
null ,
101
86
]);
102
87
app ()->register (GeocoderService::class);
103
88
104
- // Act
105
89
$ results = app ('geocoder ' )
106
90
->geocode ('Obere Donaustrasse 22, Wien, Österreich ' )
107
91
->get ();
108
92
109
- // Assert
110
93
$ this ->assertEquals ('22 ' , $ results ->first ()->getStreetNumber ());
111
94
$ this ->assertEquals ('Obere Donaustraße ' , $ results ->first ()->getStreetName ());
112
95
$ this ->assertEquals ('Wien ' , $ results ->first ()->getLocality ());
0 commit comments