Skip to content

Commit 9c56371

Browse files
committed
fix cs and add few more tests
1 parent 38ff08f commit 9c56371

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/Toin0u/Geocoder/GeocoderServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ public function register()
5454

5555
$this->app->singleton('geocoder.provider', function($app) {
5656
$providers = $app['config']->get('geocoder-laravel::providers');
57+
5758
foreach($providers as &$provider) {
5859
$provider = new $provider($app['geocoder.adapter']);
5960
}
61+
6062
return new ChainProvider($providers);
6163
});
6264

src/config/config.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
*/
1111

1212
return array(
13-
/* Providers get called in the chain order given here. The first one to return a result will be used. */
13+
// Providers get called in the chain order given here.
14+
// The first one to return a result will be used.
1415
'providers' => array(
15-
'Geocoder\Provider\FreeGeoIpProvider'
16+
'Geocoder\Provider\GoogleMapsProvider',
17+
'Geocoder\Provider\FreeGeoIpProvider',
1618
),
1719
'adapter' => 'Geocoder\HttpAdapter\CurlHttpAdapter'
1820
);

tests/Geocoder/Tests/GeocoderServiceProviderTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ class GeocoderServiceProviderTest extends TestCase
1818
{
1919
public function testConfig()
2020
{
21-
$this->assertContains('Geocoder\Provider\FreeGeoIpProvider', $this->app['config']->get('geocoder-laravel::providers'));
22-
$this->assertSame('Geocoder\HttpAdapter\CurlHttpAdapter', $this->app['config']->get('geocoder-laravel::adapter'));
21+
$this->assertTrue(is_array($providers = $this->app['config']->get('geocoder-laravel::providers')));
22+
$this->assertContains('Geocoder\\Provider\\GoogleMapsProvider', $providers);
23+
$this->assertContains('Geocoder\\Provider\\FreeGeoIpProvider', $providers);
24+
$this->assertSame('Geocoder\\HttpAdapter\\CurlHttpAdapter', $this->app['config']->get('geocoder-laravel::adapter'));
2325
}
2426

2527
public function testLoadedProviders()
@@ -42,9 +44,9 @@ public function testGeocoderChainProvider()
4244

4345
public function testGeocoderDefaultProvider()
4446
{
45-
$providersArray = $this->getProtectedProperty($this->app['geocoder.provider'], 'providers');
46-
$this->assertInstanceOf('Geocoder\\Provider\\FreeGeoIpProvider', $providersArray[0]);
47+
$providers = $this->getProtectedProperty($this->app['geocoder.provider'], 'providers');
4748

49+
$this->assertInstanceOf('Geocoder\\Provider\\GoogleMapsProvider', $providers[0]);
4850
}
4951

5052
public function testGeocoder()
@@ -60,5 +62,4 @@ protected function getProtectedProperty($testObj, $propertyName)
6062

6163
return $property->getValue($testObj);
6264
}
63-
6465
}

tests/Geocoder/Tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ protected function getPackageProviders()
2222
'Toin0u\Geocoder\GeocoderServiceProvider',
2323
);
2424
}
25+
2526
protected function getPackageAliases()
2627
{
2728
return array(

0 commit comments

Comments
 (0)