File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1010
1111namespace Bazinga \GeocoderBundle \Command ;
1212
13+ use Geocoder \Query \GeocodeQuery ;
1314use Symfony \Bundle \FrameworkBundle \Command \ContainerAwareCommand ;
1415use Symfony \Component \Console \Input \InputArgument ;
1516use Symfony \Component \Console \Input \InputInterface ;
@@ -47,14 +48,14 @@ protected function configure()
4748 */
4849 protected function execute (InputInterface $ input , OutputInterface $ output )
4950 {
50- /** @var $geocoder \Geocoder\Geocoder */
51- $ geocoder = $ this ->getContainer ()->get ('bazinga_geocoder.geocoder ' );
51+ /** @var $geocoder \Geocoder\ProviderAggregator */
52+ $ geocoder = $ this ->getContainer ()->get ('Geocoder\ProviderAggregator ' );
5253
5354 if ($ input ->getOption ('provider ' )) {
5455 $ geocoder ->using ($ input ->getOption ('provider ' ));
5556 }
5657
57- $ results = $ geocoder ->geocode ( $ input ->getArgument ('address ' ));
58+ $ results = $ geocoder ->geocodeQuery (GeocodeQuery:: create ( $ input ->getArgument ('address ' ) ));
5859 $ data = $ results ->first ()->toArray ();
5960
6061 $ max = 0 ;
Original file line number Diff line number Diff line change 1515use Geocoder \Model \AddressCollection ;
1616use Geocoder \Model \Coordinates ;
1717use Geocoder \Model \Country ;
18+ use Geocoder \ProviderAggregator ;
19+ use Geocoder \Query \GeocodeQuery ;
1820use PHPUnit \Framework \TestCase ;
1921use Symfony \Bundle \FrameworkBundle \Console \Application ;
2022use Symfony \Component \Console \Tester \CommandTester ;
@@ -40,16 +42,17 @@ public function testExecute()
4042 'countryCode ' => $ country ->getCode (),
4143 ]);
4244
43- $ geocoder = $ this ->getMockBuilder ('Geocoder \\ProviderAggregator ' )->getMock ();
45+ $ geocoder = $ this ->getMockBuilder (ProviderAggregator::class)->getMock ();
46+ $ query = GeocodeQuery::create (self ::$ address );
4447 $ geocoder ->expects ($ this ->once ())
45- ->method ('geocode ' )
46- ->with (self :: $ address )
48+ ->method ('geocodeQuery ' )
49+ ->with ($ query )
4750 ->will ($ this ->returnValue (new AddressCollection ([$ address ])));
4851
4952 $ container = $ this ->getMockBuilder ('Symfony \\Component \\DependencyInjection \\Container ' )->getMock ();
5053 $ container ->expects ($ this ->once ())
5154 ->method ('get ' )
52- ->with (' bazinga_geocoder.geocoder ' )
55+ ->with (ProviderAggregator::class )
5356 ->will ($ this ->returnValue ($ geocoder ));
5457
5558 $ kernel = $ this ->getMockBuilder ('Symfony \\Component \\HttpKernel \\Kernel ' )
You can’t perform that action at this time.
0 commit comments