Skip to content

Commit 37f7819

Browse files
committedApr 15, 2021
reformatting using DW style
1 parent 00fa07d commit 37f7819

16 files changed

+475
-444
lines changed
 

‎_test/general.test.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class general_plugin_spatialhelper_test extends DokuWikiTest {
2828
/**
2929
* Simple test to make sure the plugin.info.txt is in correct format.
3030
*/
31-
public function test_plugininfo() {
31+
public function test_plugininfo(): void {
3232
$file = __DIR__ . '/../plugin.info.txt';
3333
$this->assertFileExists($file);
3434

@@ -52,11 +52,10 @@ public function test_plugininfo() {
5252
/**
5353
* test if plugin is loaded.
5454
*/
55-
public function test_plugin_spatialhelper_isloaded() {
55+
public function test_plugin_spatialhelper_isloaded(): void {
5656
global $plugin_controller;
57-
$this->assertTrue(
58-
in_array('spatialhelper', $plugin_controller->getList()),
59-
"spatialhelper plugin is loaded"
57+
$this->assertContains(
58+
'spatialhelper', $plugin_controller->getList(), "spatialhelper plugin is loaded"
6059
);
6160
}
6261
}

‎_test/index.test.php

+49-49
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,59 @@
22

33
namespace dokuwiki\plugin\spatialhelper\test;
44

5+
use DokuWikiTest;
6+
use helper_plugin_spatialhelper_index;
7+
58
/**
69
* Tests for the class helper_plugin_spatialhelper_index of the spatialhelper plugin
710
*
811
* @group plugin_spatialhelper
912
* @group plugins
1013
*/
11-
class index_test extends \DokuWikiTest {
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-
}
58-
59-
14+
class index_test extends DokuWikiTest {
15+
16+
protected $pluginsEnabled = array('spatialhelper');
17+
18+
/**
19+
* Testdata for @return array
20+
* @see index_test::test_convertDMStoD
21+
*
22+
*/
23+
public static function convertDMStoD_testdata(): array {
24+
return array(
25+
array(
26+
array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',),
27+
52.5172,
28+
'Latitude in Europe'
29+
),
30+
array(
31+
array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',),
32+
13.5105,
33+
'Longitude in Europe'
34+
),
35+
array(
36+
array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',),
37+
50.5708,
38+
'Latitude in North America'
39+
),
40+
array(
41+
array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',),
42+
-109.4673,
43+
'Longitude in North America'
44+
),
45+
);
46+
}
47+
48+
/**
49+
* @dataProvider convertDMStoD_testdata
50+
*
51+
*/
52+
public function test_convertDMStoD($input, $expected_output, $msg): void {
53+
/** @var helper_plugin_spatialhelper_index $index */
54+
$index = plugin_load('helper', 'spatialhelper_index');
55+
56+
$actual_output = $index->convertDMStoD($input);
57+
58+
$this->assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg);
59+
}
6060
}

0 commit comments

Comments
 (0)
Please sign in to comment.