forked from geocoder-php/Geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoundsPluginTest.php
More file actions
53 lines (45 loc) · 1.48 KB
/
Copy pathBoundsPluginTest.php
File metadata and controls
53 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
/*
* This file is part of the Geocoder package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Geocoder\Plugin\Tests\Plugin;
use Geocoder\Model\Bounds;
use Geocoder\Plugin\Plugin\BoundsPlugin;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\Query;
use Geocoder\Query\ReverseQuery;
use PHPUnit\Framework\TestCase;
class BoundsPluginTest extends TestCase
{
public function testGeocode()
{
$bounds = new Bounds(4, 7, 1, 1);
$query = GeocodeQuery::create('foo');
$first = function (Query $query) {
$this->fail('Plugin should not restart the chain');
};
$next = function (GeocodeQuery $query) use ($bounds) {
$this->assertEquals($bounds, $query->getBounds());
};
$plugin = new BoundsPlugin($bounds);
$plugin->handleQuery($query, $next, $first);
}
public function testReverse()
{
$bounds = new Bounds(4, 7, 1, 1);
$query = ReverseQuery::fromCoordinates(71, 11);
$first = function (Query $query) {
$this->fail('Plugin should not restart the chain');
};
$next = function (Query $query) use ($bounds) {
$this->assertTrue(true, 'We should not fail on ReverseQuery');
};
$plugin = new BoundsPlugin($bounds);
$plugin->handleQuery($query, $next, $first);
}
}