1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright Andreas Heigl <[email protected]> |
4
|
|
|
* |
5
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
6
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
7
|
|
|
* in the Software without restriction, including without limitation the rights |
8
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
9
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
10
|
|
|
* furnished to do so, subject to the following conditions: |
11
|
|
|
* |
12
|
|
|
* The above copyright notice and this permission notice shall be included in |
13
|
|
|
* all copies or substantial portions of the Software. |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19
|
|
|
* LIBILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
21
|
|
|
* THE SOFTWARE. |
22
|
|
|
* |
23
|
|
|
* @author Andreas Heigl<[email protected]> |
24
|
|
|
* @copyright Andreas Heigl |
25
|
|
|
* @license http://www.opesource.org/licenses/mit-license.php MIT-License |
26
|
|
|
* @version 0.0 |
27
|
|
|
* @since 26.05.15 |
28
|
|
|
* @link https://github.com/heiglandreas/OrgHeiglGeolocation |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
namespace Org_Heigl\GeolocationTest\Filter\Geolocation; |
32
|
|
|
|
33
|
|
|
use Org_Heigl\Geolocation\Filter\Geolocation; |
34
|
|
|
use PHPUnit\Framework\TestCase; |
35
|
|
|
|
36
|
|
|
class GeolocationTest extends TestCase |
37
|
|
|
{ |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @dataProvider filterProvider |
41
|
|
|
* @param $input |
42
|
|
|
* @param $expected |
43
|
|
|
* @covers \Org_Heigl\Geolocation\Filter\Geolocation::filter() |
44
|
|
|
*/ |
45
|
|
|
public function testThatFilteringWorksAsExpected($input, $expected) |
46
|
|
|
{ |
47
|
|
|
$filter = new Geolocation(); |
48
|
|
|
|
49
|
|
|
$this->assertEquals($expected, $filter->filter($input)); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function filterProvider() |
53
|
|
|
{ |
54
|
|
|
return array( |
55
|
|
|
array('0 0', '0 0'), |
56
|
|
|
array('90.0 90.0', '90 90'), |
57
|
|
|
array('90.0 180.0', '90 180'), |
58
|
|
|
array('90.0 -180.0', '90 -180'), |
59
|
|
|
array('90.0 190.0', '90 -170'), |
60
|
|
|
array('50.0 -190.0', '50 170'), |
61
|
|
|
array('50.0 360.0', '50 0'), |
62
|
|
|
array('50.0 -360.0', '50 -0'), |
63
|
|
|
array('50.0 400.0', '50 40'), |
64
|
|
|
array('50.0 360.5', '50 0.5'), |
65
|
|
|
array('50.0 -360.5', '50 -0.5'), |
66
|
|
|
array('50.0 400.5', '50 40.5'), |
67
|
|
|
array('50.0 -400.5', '50 -40.5'), |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|