@@ -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 | } |
@@ -27,63 +27,63 @@ |
||
27 | 27 | */ |
28 | 28 | class admin_plugin_spatialhelper_purge extends AdminPlugin |
29 | 29 | { |
30 | - /** |
|
31 | - * |
|
32 | - * @see DokuWiki_Admin_Plugin::getMenuSort() |
|
33 | - */ |
|
34 | - final public function getMenuSort(): int |
|
35 | - { |
|
36 | - return 801; |
|
37 | - } |
|
30 | + /** |
|
31 | + * |
|
32 | + * @see DokuWiki_Admin_Plugin::getMenuSort() |
|
33 | + */ |
|
34 | + final public function getMenuSort(): int |
|
35 | + { |
|
36 | + return 801; |
|
37 | + } |
|
38 | 38 | |
39 | - final public function getMenuIcon(): string |
|
40 | - { |
|
41 | - $plugin = $this->getPluginName(); |
|
42 | - return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
43 | - } |
|
39 | + final public function getMenuIcon(): string |
|
40 | + { |
|
41 | + $plugin = $this->getPluginName(); |
|
42 | + return DOKU_PLUGIN . $plugin . '/admin/purge.svg'; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * purge and regenerate the index and sitemaps. |
|
47 | - * |
|
48 | - * @see DokuWiki_Admin_Plugin::handle() |
|
49 | - */ |
|
50 | - final public function handle(): void |
|
51 | - { |
|
52 | - if (isset($_REQUEST ['purgeindex'])) { |
|
53 | - global $conf; |
|
54 | - $path = $conf ['indexdir'] . '/spatial.idx'; |
|
55 | - if (file_exists($path) && unlink($path)) { |
|
56 | - msg($this->getLang('admin_purged_tiles'), 0); |
|
57 | - } |
|
58 | - } |
|
45 | + /** |
|
46 | + * purge and regenerate the index and sitemaps. |
|
47 | + * |
|
48 | + * @see DokuWiki_Admin_Plugin::handle() |
|
49 | + */ |
|
50 | + final public function handle(): void |
|
51 | + { |
|
52 | + if (isset($_REQUEST ['purgeindex'])) { |
|
53 | + global $conf; |
|
54 | + $path = $conf ['indexdir'] . '/spatial.idx'; |
|
55 | + if (file_exists($path) && unlink($path)) { |
|
56 | + msg($this->getLang('admin_purged_tiles'), 0); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - $indexer = plugin_load('helper', 'spatialhelper_index'); |
|
61 | - if (isset($indexer)) { |
|
62 | - $indexer->generateSpatialIndex(); |
|
63 | - } |
|
60 | + $indexer = plugin_load('helper', 'spatialhelper_index'); |
|
61 | + if (isset($indexer)) { |
|
62 | + $indexer->generateSpatialIndex(); |
|
63 | + } |
|
64 | 64 | |
65 | - $sitemapper = plugin_load('helper', 'spatialhelper_sitemap'); |
|
66 | - if (isset($sitemapper)) { |
|
67 | - $sitemapper->createKMLSitemap($this->getConf('media_kml')); |
|
68 | - $sitemapper->createGeoRSSSitemap($this->getConf('media_georss')); |
|
69 | - } |
|
70 | - } |
|
65 | + $sitemapper = plugin_load('helper', 'spatialhelper_sitemap'); |
|
66 | + if (isset($sitemapper)) { |
|
67 | + $sitemapper->createKMLSitemap($this->getConf('media_kml')); |
|
68 | + $sitemapper->createGeoRSSSitemap($this->getConf('media_georss')); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * render the form for this plugin. |
|
74 | - * |
|
75 | - * @see DokuWiki_Admin_Plugin::html() |
|
76 | - */ |
|
77 | - final public function html(): void |
|
78 | - { |
|
79 | - echo $this->locale_xhtml('admin_purge_intro'); |
|
72 | + /** |
|
73 | + * render the form for this plugin. |
|
74 | + * |
|
75 | + * @see DokuWiki_Admin_Plugin::html() |
|
76 | + */ |
|
77 | + final public function html(): void |
|
78 | + { |
|
79 | + echo $this->locale_xhtml('admin_purge_intro'); |
|
80 | 80 | |
81 | - $form = new Form( |
|
82 | - ['id' => 'spatialhelper__purgeform', 'method' => 'post'] |
|
83 | - ); |
|
84 | - $form->setHiddenField('purgeindex', 'true'); |
|
85 | - $form->addButton('submit', $this->getLang('admin_submit')) |
|
86 | - ->attr('title', $this->getLang('admin_submit')); |
|
87 | - echo $form->toHTML(); |
|
88 | - } |
|
81 | + $form = new Form( |
|
82 | + ['id' => 'spatialhelper__purgeform', 'method' => 'post'] |
|
83 | + ); |
|
84 | + $form->setHiddenField('purgeindex', 'true'); |
|
85 | + $form->addButton('submit', $this->getLang('admin_submit')) |
|
86 | + ->attr('title', $this->getLang('admin_submit')); |
|
87 | + echo $form->toHTML(); |
|
88 | + } |
|
89 | 89 | } |