@@ -20,22 +20,22 @@ |
||
20 | 20 | public static function convertDMStoD_testdata() { |
21 | 21 | return array( |
22 | 22 | array( |
23 | - array ( 0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N', ), |
|
23 | + array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',), |
|
24 | 24 | 52.5172, |
25 | 25 | 'Latitude in Europe' |
26 | 26 | ), |
27 | 27 | array( |
28 | - array ( 0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E', ), |
|
28 | + array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',), |
|
29 | 29 | 13.5105, |
30 | 30 | 'Longitude in Europe' |
31 | 31 | ), |
32 | 32 | array( |
33 | - array ( 0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N', ), |
|
33 | + array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',), |
|
34 | 34 | 50.5708, |
35 | 35 | 'Latitude in North America' |
36 | 36 | ), |
37 | 37 | array( |
38 | - array ( 0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W', ), |
|
38 | + array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',), |
|
39 | 39 | -109.4673, |
40 | 40 | 'Longitude in North America' |
41 | 41 | ), |
@@ -10,51 +10,51 @@ |
||
10 | 10 | */ |
11 | 11 | class index_test extends \DokuWikiTest { |
12 | 12 | |
13 | - protected $pluginsEnabled = array('spatialhelper'); |
|
14 | - |
|
15 | - /** |
|
16 | - * Testdata for @see index_test::test_convertDMStoD |
|
17 | - * |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - public static function convertDMStoD_testdata() { |
|
21 | - return array( |
|
22 | - array( |
|
23 | - array ( 0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N', ), |
|
24 | - 52.5172, |
|
25 | - 'Latitude in Europe' |
|
26 | - ), |
|
27 | - array( |
|
28 | - array ( 0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E', ), |
|
29 | - 13.5105, |
|
30 | - 'Longitude in Europe' |
|
31 | - ), |
|
32 | - array( |
|
33 | - array ( 0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N', ), |
|
34 | - 50.5708, |
|
35 | - 'Latitude in North America' |
|
36 | - ), |
|
37 | - array( |
|
38 | - array ( 0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W', ), |
|
39 | - -109.4673, |
|
40 | - 'Longitude in North America' |
|
41 | - ), |
|
42 | - ); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * @dataProvider convertDMStoD_testdata |
|
48 | - * |
|
49 | - */ |
|
50 | - public function test_convertDMStoD($input, $expected_output, $msg) { |
|
51 | - /** @var \helper_plugin_spatialhelper_index $index */ |
|
52 | - $index = plugin_load('helper', 'spatialhelper_index'); |
|
53 | - |
|
54 | - $actual_output = $index->convertDMStoD($input); |
|
55 | - |
|
56 | - $this->assertEquals($expected_output, $actual_output, $msg, 0.0001); |
|
57 | - } |
|
13 | + protected $pluginsEnabled = array('spatialhelper'); |
|
14 | + |
|
15 | + /** |
|
16 | + * Testdata for @see index_test::test_convertDMStoD |
|
17 | + * |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + public static function convertDMStoD_testdata() { |
|
21 | + return array( |
|
22 | + array( |
|
23 | + array ( 0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N', ), |
|
24 | + 52.5172, |
|
25 | + 'Latitude in Europe' |
|
26 | + ), |
|
27 | + array( |
|
28 | + array ( 0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E', ), |
|
29 | + 13.5105, |
|
30 | + 'Longitude in Europe' |
|
31 | + ), |
|
32 | + array( |
|
33 | + array ( 0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N', ), |
|
34 | + 50.5708, |
|
35 | + 'Latitude in North America' |
|
36 | + ), |
|
37 | + array( |
|
38 | + array ( 0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W', ), |
|
39 | + -109.4673, |
|
40 | + 'Longitude in North America' |
|
41 | + ), |
|
42 | + ); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * @dataProvider convertDMStoD_testdata |
|
48 | + * |
|
49 | + */ |
|
50 | + public function test_convertDMStoD($input, $expected_output, $msg) { |
|
51 | + /** @var \helper_plugin_spatialhelper_index $index */ |
|
52 | + $index = plugin_load('helper', 'spatialhelper_index'); |
|
53 | + |
|
54 | + $actual_output = $index->convertDMStoD($input); |
|
55 | + |
|
56 | + $this->assertEquals($expected_output, $actual_output, $msg, 0.0001); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | 60 | } |
@@ -286,8 +286,8 @@ |
||
286 | 286 | $min = $this->convertRationaltoFloat($param [1]) / 60; |
287 | 287 | $sec = $this->convertRationaltoFloat($param [2]) / 60 / 60; |
288 | 288 | // Hemisphere (N, S, W or E) |
289 | - $hem = ($param [3] === 'N' || $param [3] === 'E') ? 1 : -1; |
|
290 | - return $hem * ($deg + $min + $sec); |
|
289 | + $hem = ($param [3] === 'N' || $param [3] === 'E') ? 1 : -1; |
|
290 | + return $hem * ($deg + $min + $sec); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | public function convertRationaltoFloat($param) { |