1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2018 - present |
4
|
|
|
* Google Maps PHP - LatLngBountTest.php |
5
|
|
|
* author: Roberto Belotti - [email protected] |
6
|
|
|
* web : robertobelotti.com, github.com/biscolab |
7
|
|
|
* Initial version created on: 5/9/2018 |
8
|
|
|
* MIT license: https://github.com/biscolab/google-maps-php/blob/master/LICENSE |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Biscolab\geocode\Tests; |
12
|
|
|
|
13
|
|
|
use Biscolab\GoogleMaps\Fields\LatLngBoundsFields; |
14
|
|
|
use Biscolab\GoogleMaps\Fields\LatLngFields; |
15
|
|
|
use Biscolab\GoogleMaps\Object\LatLng; |
16
|
|
|
use Biscolab\GoogleMaps\Object\LatLngBounds; |
17
|
|
|
use PHPUnit\Framework\TestCase; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class LatLngBountTest |
21
|
|
|
* @package Biscolab\geocode\Tests |
22
|
|
|
*/ |
23
|
|
|
class LatLngBountTest extends TestCase { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var LatLngBounds |
27
|
|
|
*/ |
28
|
|
|
private $lat_lng_bounds; |
29
|
|
|
|
30
|
|
|
public function setUp()/* The :void return type declaration that should be here would cause a BC issue */ { |
31
|
|
|
|
32
|
|
|
parent::setUp(); // TODO: Change the autogenerated stub |
33
|
|
|
|
34
|
|
|
$this->lat_lng_bounds = new LatLngBounds(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @test |
39
|
|
|
*/ |
40
|
|
|
public function testLatLngBoundSetterGetter() { |
41
|
|
|
|
42
|
|
|
$lat_lng_bounds = $this->lat_lng_bounds; |
43
|
|
|
|
44
|
|
|
$southwest = new LatLng([ |
45
|
|
|
LatLngFields::LAT => 20.89, |
46
|
|
|
LatLngFields::LNG => -40.82, |
47
|
|
|
]); |
48
|
|
|
|
49
|
|
|
$northeast = new LatLng([ |
50
|
|
|
LatLngFields::LAT => 22.73, |
51
|
|
|
LatLngFields::LNG => 3.6370, |
52
|
|
|
]); |
53
|
|
|
|
54
|
|
|
$lat_lng_bounds->setSouthwest($southwest); |
|
|
|
|
55
|
|
|
$lat_lng_bounds->setNortheast($northeast); |
|
|
|
|
56
|
|
|
|
57
|
|
|
$this->assertEquals(new LatLngBounds([ |
58
|
|
|
LatLngBoundsFields::SOUTHWEST => [ |
59
|
|
|
LatLngFields::LAT => 20.89, |
60
|
|
|
LatLngFields::LNG => -40.82, |
61
|
|
|
], |
62
|
|
|
LatLngBoundsFields::NORTHEAST => [ |
63
|
|
|
LatLngFields::LAT => 22.73, |
64
|
|
|
LatLngFields::LNG => 3.6370, |
65
|
|
|
], |
66
|
|
|
]), $lat_lng_bounds); |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|