Skip to content

Commit b3267f2

Browse files
committed
Fix tests, fix CS
1 parent 76a31aa commit b3267f2

File tree

9 files changed

+21
-18
lines changed

9 files changed

+21
-18
lines changed

DependencyInjection/BazingaGeocoderExtension.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ public function load(array $configs, ContainerBuilder $container)
152152
}
153153

154154
if (isset($config['providers']['maxmind_binary'])) {
155-
$maxmindBinaryParams = $config['providers']['maxmind_binary'];
156-
157155
$provider = new Definition(
158156
'%bazinga_geocoder.geocoder.provider.maxmind_binary.class%',
159157
array(
@@ -170,24 +168,27 @@ public function load(array $configs, ContainerBuilder $container)
170168
}
171169

172170
if (isset($config['providers']['cache'])) {
173-
$params = $config['providers']['cache'];
174-
$cache = new Reference($params['adapter']);
171+
$params = $config['providers']['cache'];
172+
$cache = new Reference($params['adapter']);
175173
$fallback = new Reference('bazinga_geocoder.provider.'.$params['provider']);
176174

177-
$provider = new Definition('%bazinga_geocoder.geocoder.provider.cache.class%');
178-
$provider->setArguments(array($cache, $fallback, $params['lifetime']));
175+
$provider = new Definition(
176+
'%bazinga_geocoder.geocoder.provider.cache.class%',
177+
array($cache, $fallback, $params['lifetime'])
178+
);
179179

180180
if (isset($params['locale'])) {
181181
$provider->addArgument($params['locale']);
182182
}
183183

184-
$provider->setPublic(false)->addTag('bazinga_geocoder.provider');
184+
$provider
185+
->setPublic(false)
186+
->addTag('bazinga_geocoder.provider');
185187

186188
$container->setDefinition('bazinga_geocoder.provider.cache', $provider);
187189
}
188190

189191
if (isset($config['providers']['chain'])) {
190-
191192
$chainProvider = new Definition(
192193
'%bazinga_geocoder.geocoder.provider.chain.class%'
193194
);

DependencyInjection/Compiler/AddProvidersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AddProvidersPass implements CompilerPassInterface
2727
/**
2828
* Get all providers based on their tag ('geocoder.provider') and register them.
2929
*
30-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
30+
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
3131
*/
3232
public function process(ContainerBuilder $container)
3333
{

DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace Bazinga\Bundle\GeocoderBundle\DependencyInjection;
1212

13-
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1413
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1514
use Symfony\Component\Config\Definition\ConfigurationInterface;
1615

DumperManager.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @license MIT License
88
*/
99

10-
1110
namespace Bazinga\Bundle\GeocoderBundle;
1211

1312
use Geocoder\Dumper\DumperInterface;

Provider/CacheProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class CacheProvider implements ProviderInterface
4141
/**
4242
* Constructor
4343
*
44-
* @param Cache $cache The cache interface
45-
* @param ProviderInterface $provider The fallback provider
46-
* @param integer $lifetime The cache lifetime
44+
* @param Cache $cache The cache interface
45+
* @param ProviderInterface $provider The fallback provider
46+
* @param integer $lifetime The cache lifetime
4747
*/
4848
public function __construct(Cache $cache, ProviderInterface $provider, $lifetime = 0, $locale = null)
4949
{

Tests/DependencyInjection/BazingaGeocoderExtensionTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ class BazingaGeocoderExtensionTest extends \PHPUnit_Framework_TestCase
1616
{
1717
public function testLoad()
1818
{
19-
$configs = Yaml::parse(file_get_contents(__DIR__.'/Fixtures/config.yml'));
19+
$configs = Yaml::parse(file_get_contents(__DIR__.'/Fixtures/config.yml'));
2020
$container = new ContainerBuilder();
2121
$extension = new BazingaGeocoderExtension();
2222

23+
$container->setParameter('fixtures_dir', __DIR__ . '/Fixtures');
24+
2325
$container->set('doctrine.apc.cache', new ArrayCache());
2426

2527
$container->addCompilerPass(new AddDumperPass());
@@ -38,7 +40,7 @@ public function testLoad()
3840
$this->assertTrue($dumperManager->has($name));
3941
}
4042

41-
$geocoder = $container->get('bazinga_geocoder.geocoder');
43+
$geocoder = $container->get('bazinga_geocoder.geocoder');
4244
$providers = $geocoder->getProviders();
4345
foreach (array(
4446
'bing_maps' => 'Geocoder\\Provider\\BingMapsProvider',
@@ -61,6 +63,7 @@ public function testLoad()
6163
'geo_plugin' => 'Geocoder\\Provider\\GeoPluginProvider',
6264
'maxmind' => 'Geocoder\\Provider\\MaxmindProvider',
6365
'chain' => 'Geocoder\\Provider\\ChainProvider',
66+
'maxmind_binary' => 'Geocoder\\Provider\\MaxmindBinaryProvider',
6467
) as $name => $class) {
6568
$this->assertInstanceOf($class, $providers[$name], sprintf('-> Assert that %s is instance of %s', $name, $class));
6669
}

Tests/DependencyInjection/Fixtures/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ bazinga_geocoder:
4242
maxmind:
4343
api_key: 123
4444
maxmind_binary:
45-
binary_file: /path/to/maxmind.dat
45+
binary_file: %fixtures_dir%/maxmind.dat
4646
chain:
4747
providers: [free_geo_ip, host_ip]

Tests/DependencyInjection/Fixtures/maxmind.dat

Whitespace-only changes.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"symfony/console": ">=2.0,<2.4-dev"
1717
},
1818
"require-dev": {
19-
"symfony/yaml": ">=2.0,<2.4-dev"
19+
"symfony/yaml": ">=2.0,<2.4-dev",
20+
"maxromanovsky/php-maxmind-geoip": "~1.12"
2021
},
2122
"autoload": {
2223
"psr-0": { "Bazinga\\Bundle\\GeocoderBundle": "" }

0 commit comments

Comments
 (0)