@@ -14,49 +14,49 @@ |
||
| 14 | 14 | class index_test extends DokuWikiTest |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - protected $pluginsEnabled = array('spatialhelper'); |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * Testdata for @return array |
|
| 21 | - * @see index_test::test_convertDMStoD |
|
| 22 | - * |
|
| 23 | - */ |
|
| 24 | - final public static function convertDMStoDTestdata(): array |
|
| 25 | - { |
|
| 26 | - return array( |
|
| 27 | - array( |
|
| 28 | - array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',), |
|
| 29 | - 52.5172, |
|
| 30 | - 'Latitude in Europe' |
|
| 31 | - ), |
|
| 32 | - array( |
|
| 33 | - array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',), |
|
| 34 | - 13.5105, |
|
| 35 | - 'Longitude in Europe' |
|
| 36 | - ), |
|
| 37 | - array( |
|
| 38 | - array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',), |
|
| 39 | - 50.5708, |
|
| 40 | - 'Latitude in North America' |
|
| 41 | - ), |
|
| 42 | - array( |
|
| 43 | - array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',), |
|
| 44 | - -109.4673, |
|
| 45 | - 'Longitude in North America' |
|
| 46 | - ), |
|
| 47 | - ); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @dataProvider convertDMStoDTestdata |
|
| 52 | - */ |
|
| 53 | - final public function test_convertDMStoD(array $input, float $expected_output, string $msg): void |
|
| 54 | - { |
|
| 55 | - $index = plugin_load('helper', 'spatialhelper_index'); |
|
| 56 | - assert($index instanceof helper_plugin_spatialhelper_index); |
|
| 57 | - |
|
| 58 | - $actual_output = $index->convertDMStoD($input); |
|
| 59 | - |
|
| 60 | - self::assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg); |
|
| 61 | - } |
|
| 17 | + protected $pluginsEnabled = array('spatialhelper'); |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * Testdata for @return array |
|
| 21 | + * @see index_test::test_convertDMStoD |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | + final public static function convertDMStoDTestdata(): array |
|
| 25 | + { |
|
| 26 | + return array( |
|
| 27 | + array( |
|
| 28 | + array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',), |
|
| 29 | + 52.5172, |
|
| 30 | + 'Latitude in Europe' |
|
| 31 | + ), |
|
| 32 | + array( |
|
| 33 | + array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',), |
|
| 34 | + 13.5105, |
|
| 35 | + 'Longitude in Europe' |
|
| 36 | + ), |
|
| 37 | + array( |
|
| 38 | + array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',), |
|
| 39 | + 50.5708, |
|
| 40 | + 'Latitude in North America' |
|
| 41 | + ), |
|
| 42 | + array( |
|
| 43 | + array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',), |
|
| 44 | + -109.4673, |
|
| 45 | + 'Longitude in North America' |
|
| 46 | + ), |
|
| 47 | + ); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @dataProvider convertDMStoDTestdata |
|
| 52 | + */ |
|
| 53 | + final public function test_convertDMStoD(array $input, float $expected_output, string $msg): void |
|
| 54 | + { |
|
| 55 | + $index = plugin_load('helper', 'spatialhelper_index'); |
|
| 56 | + assert($index instanceof helper_plugin_spatialhelper_index); |
|
| 57 | + |
|
| 58 | + $actual_output = $index->convertDMStoD($input); |
|
| 59 | + |
|
| 60 | + self::assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg); |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -24,41 +24,41 @@ |
||
| 24 | 24 | class general_plugin_spatialhelper_test extends DokuWikiTest |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - protected $pluginsEnabled = array('spatialhelper'); |
|
| 27 | + protected $pluginsEnabled = array('spatialhelper'); |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Simple test to make sure the plugin.info.txt is in correct format. |
|
| 31 | - */ |
|
| 32 | - final public function test_plugininfo(): void |
|
| 33 | - { |
|
| 34 | - $file = __DIR__ . '/../plugin.info.txt'; |
|
| 35 | - self::assertFileExists($file); |
|
| 29 | + /** |
|
| 30 | + * Simple test to make sure the plugin.info.txt is in correct format. |
|
| 31 | + */ |
|
| 32 | + final public function test_plugininfo(): void |
|
| 33 | + { |
|
| 34 | + $file = __DIR__ . '/../plugin.info.txt'; |
|
| 35 | + self::assertFileExists($file); |
|
| 36 | 36 | |
| 37 | - $info = confToHash($file); |
|
| 37 | + $info = confToHash($file); |
|
| 38 | 38 | |
| 39 | - self::assertArrayHasKey('base', $info); |
|
| 40 | - self::assertArrayHasKey('author', $info); |
|
| 41 | - self::assertArrayHasKey('email', $info); |
|
| 42 | - self::assertArrayHasKey('date', $info); |
|
| 43 | - self::assertArrayHasKey('name', $info); |
|
| 44 | - self::assertArrayHasKey('desc', $info); |
|
| 45 | - self::assertArrayHasKey('url', $info); |
|
| 39 | + self::assertArrayHasKey('base', $info); |
|
| 40 | + self::assertArrayHasKey('author', $info); |
|
| 41 | + self::assertArrayHasKey('email', $info); |
|
| 42 | + self::assertArrayHasKey('date', $info); |
|
| 43 | + self::assertArrayHasKey('name', $info); |
|
| 44 | + self::assertArrayHasKey('desc', $info); |
|
| 45 | + self::assertArrayHasKey('url', $info); |
|
| 46 | 46 | |
| 47 | - self::assertEquals('spatialhelper', $info['base']); |
|
| 48 | - self::assertRegExp('/^https?:\/\//', $info['url']); |
|
| 49 | - self::assertTrue(mail_isvalid($info['email'])); |
|
| 50 | - self::assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
| 51 | - self::assertNotFalse(strtotime($info['date'])); |
|
| 52 | - } |
|
| 47 | + self::assertEquals('spatialhelper', $info['base']); |
|
| 48 | + self::assertRegExp('/^https?:\/\//', $info['url']); |
|
| 49 | + self::assertTrue(mail_isvalid($info['email'])); |
|
| 50 | + self::assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); |
|
| 51 | + self::assertNotFalse(strtotime($info['date'])); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * test if plugin is loaded. |
|
| 56 | - */ |
|
| 57 | - final public function test_plugin_spatialhelper_isloaded(): void |
|
| 58 | - { |
|
| 59 | - global $plugin_controller; |
|
| 60 | - self::assertContains( |
|
| 61 | - 'spatialhelper', $plugin_controller->getList(), "spatialhelper plugin is loaded" |
|
| 62 | - ); |
|
| 63 | - } |
|
| 54 | + /** |
|
| 55 | + * test if plugin is loaded. |
|
| 56 | + */ |
|
| 57 | + final public function test_plugin_spatialhelper_isloaded(): void |
|
| 58 | + { |
|
| 59 | + global $plugin_controller; |
|
| 60 | + self::assertContains( |
|
| 61 | + 'spatialhelper', $plugin_controller->getList(), "spatialhelper plugin is loaded" |
|
| 62 | + ); |
|
| 63 | + } |
|
| 64 | 64 | } |