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 10
10
11
11
namespace Bazinga \GeocoderBundle \Command ;
12
12
13
+ use Geocoder \Query \GeocodeQuery ;
13
14
use Symfony \Bundle \FrameworkBundle \Command \ContainerAwareCommand ;
14
15
use Symfony \Component \Console \Input \InputArgument ;
15
16
use Symfony \Component \Console \Input \InputInterface ;
@@ -47,14 +48,14 @@ protected function configure()
47
48
*/
48
49
protected function execute (InputInterface $ input , OutputInterface $ output )
49
50
{
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 ' );
52
53
53
54
if ($ input ->getOption ('provider ' )) {
54
55
$ geocoder ->using ($ input ->getOption ('provider ' ));
55
56
}
56
57
57
- $ results = $ geocoder ->geocode ( $ input ->getArgument ('address ' ));
58
+ $ results = $ geocoder ->geocodeQuery (GeocodeQuery:: create ( $ input ->getArgument ('address ' ) ));
58
59
$ data = $ results ->first ()->toArray ();
59
60
60
61
$ max = 0 ;
Original file line number Diff line number Diff line change 15
15
use Geocoder \Model \AddressCollection ;
16
16
use Geocoder \Model \Coordinates ;
17
17
use Geocoder \Model \Country ;
18
+ use Geocoder \ProviderAggregator ;
19
+ use Geocoder \Query \GeocodeQuery ;
18
20
use PHPUnit \Framework \TestCase ;
19
21
use Symfony \Bundle \FrameworkBundle \Console \Application ;
20
22
use Symfony \Component \Console \Tester \CommandTester ;
@@ -40,16 +42,17 @@ public function testExecute()
40
42
'countryCode ' => $ country ->getCode (),
41
43
]);
42
44
43
- $ geocoder = $ this ->getMockBuilder ('Geocoder \\ProviderAggregator ' )->getMock ();
45
+ $ geocoder = $ this ->getMockBuilder (ProviderAggregator::class)->getMock ();
46
+ $ query = GeocodeQuery::create (self ::$ address );
44
47
$ geocoder ->expects ($ this ->once ())
45
- ->method ('geocode ' )
46
- ->with (self :: $ address )
48
+ ->method ('geocodeQuery ' )
49
+ ->with ($ query )
47
50
->will ($ this ->returnValue (new AddressCollection ([$ address ])));
48
51
49
52
$ container = $ this ->getMockBuilder ('Symfony \\Component \\DependencyInjection \\Container ' )->getMock ();
50
53
$ container ->expects ($ this ->once ())
51
54
->method ('get ' )
52
- ->with (' bazinga_geocoder.geocoder ' )
55
+ ->with (ProviderAggregator::class )
53
56
->will ($ this ->returnValue ($ geocoder ));
54
57
55
58
$ kernel = $ this ->getMockBuilder ('Symfony \\Component \\HttpKernel \\Kernel ' )
You can’t perform that action at this time.
0 commit comments