@@ -14,50 +14,50 @@ |
||
14 | 14 | class index_test extends DokuWikiTest |
15 | 15 | { |
16 | 16 | |
17 | - protected $pluginsEnabled = array('spatialhelper'); |
|
18 | - |
|
19 | - /** |
|
20 | - * Test data provider. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - * @see index_test::test_convertDMStoD |
|
24 | - */ |
|
25 | - final public static function convertDMStoDTestdata(): array |
|
26 | - { |
|
27 | - return array( |
|
28 | - array( |
|
29 | - array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',), |
|
30 | - 52.5172, |
|
31 | - 'Latitude in Europe' |
|
32 | - ), |
|
33 | - array( |
|
34 | - array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',), |
|
35 | - 13.5105, |
|
36 | - 'Longitude in Europe' |
|
37 | - ), |
|
38 | - array( |
|
39 | - array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',), |
|
40 | - 50.5708, |
|
41 | - 'Latitude in North America' |
|
42 | - ), |
|
43 | - array( |
|
44 | - array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',), |
|
45 | - -109.4673, |
|
46 | - 'Longitude in North America' |
|
47 | - ), |
|
48 | - ); |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * @dataProvider convertDMStoDTestdata |
|
53 | - */ |
|
54 | - final public function test_convertDMStoD(array $input, float $expected_output, string $msg): void |
|
55 | - { |
|
56 | - $index = plugin_load('helper', 'spatialhelper_index'); |
|
57 | - assert($index instanceof helper_plugin_spatialhelper_index); |
|
58 | - |
|
59 | - $actual_output = $index->convertDMStoD($input); |
|
60 | - |
|
61 | - self::assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg); |
|
62 | - } |
|
17 | + protected $pluginsEnabled = array('spatialhelper'); |
|
18 | + |
|
19 | + /** |
|
20 | + * Test data provider. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + * @see index_test::test_convertDMStoD |
|
24 | + */ |
|
25 | + final public static function convertDMStoDTestdata(): array |
|
26 | + { |
|
27 | + return array( |
|
28 | + array( |
|
29 | + array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',), |
|
30 | + 52.5172, |
|
31 | + 'Latitude in Europe' |
|
32 | + ), |
|
33 | + array( |
|
34 | + array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',), |
|
35 | + 13.5105, |
|
36 | + 'Longitude in Europe' |
|
37 | + ), |
|
38 | + array( |
|
39 | + array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',), |
|
40 | + 50.5708, |
|
41 | + 'Latitude in North America' |
|
42 | + ), |
|
43 | + array( |
|
44 | + array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',), |
|
45 | + -109.4673, |
|
46 | + 'Longitude in North America' |
|
47 | + ), |
|
48 | + ); |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * @dataProvider convertDMStoDTestdata |
|
53 | + */ |
|
54 | + final public function test_convertDMStoD(array $input, float $expected_output, string $msg): void |
|
55 | + { |
|
56 | + $index = plugin_load('helper', 'spatialhelper_index'); |
|
57 | + assert($index instanceof helper_plugin_spatialhelper_index); |
|
58 | + |
|
59 | + $actual_output = $index->convertDMStoD($input); |
|
60 | + |
|
61 | + self::assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg); |
|
62 | + } |
|
63 | 63 | } |
@@ -24,45 +24,45 @@ |
||
24 | 24 | class indexing_test extends DokuWikiTest |
25 | 25 | { |
26 | 26 | |
27 | - protected $pluginsEnabled = array('geotag', 'spatialhelper'); |
|
27 | + protected $pluginsEnabled = array('geotag', 'spatialhelper'); |
|
28 | 28 | |
29 | - /** |
|
30 | - * copy data and add pages to the index. |
|
31 | - */ |
|
32 | - public static function setUpBeforeClass(): void |
|
33 | - { |
|
34 | - parent::setUpBeforeClass(); |
|
35 | - global $conf; |
|
36 | - $conf['allowdebug'] = 1; |
|
29 | + /** |
|
30 | + * copy data and add pages to the index. |
|
31 | + */ |
|
32 | + public static function setUpBeforeClass(): void |
|
33 | + { |
|
34 | + parent::setUpBeforeClass(); |
|
35 | + global $conf; |
|
36 | + $conf['allowdebug'] = 1; |
|
37 | 37 | |
38 | - TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/'); |
|
39 | - } |
|
38 | + TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/'); |
|
39 | + } |
|
40 | 40 | |
41 | - final public function setUp(): void |
|
42 | - { |
|
43 | - parent::setUp(); |
|
41 | + final public function setUp(): void |
|
42 | + { |
|
43 | + parent::setUp(); |
|
44 | 44 | |
45 | - global $conf; |
|
46 | - $conf['allowdebug'] = 1; |
|
47 | - $conf['cachetime'] = -1; |
|
45 | + global $conf; |
|
46 | + $conf['allowdebug'] = 1; |
|
47 | + $conf['cachetime'] = -1; |
|
48 | 48 | |
49 | - $data = array(); |
|
50 | - search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true)); |
|
49 | + $data = array(); |
|
50 | + search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true)); |
|
51 | 51 | |
52 | - $verbose = false; |
|
53 | - $force = false; |
|
54 | - foreach ($data as $val) { |
|
55 | - idx_addPage($val['id'], $verbose, $force); |
|
56 | - } |
|
57 | - } |
|
52 | + $verbose = false; |
|
53 | + $force = false; |
|
54 | + foreach ($data as $val) { |
|
55 | + idx_addPage($val['id'], $verbose, $force); |
|
56 | + } |
|
57 | + } |
|
58 | 58 | |
59 | - final public function test_indexed(): void |
|
60 | - { |
|
61 | - // render the page |
|
62 | - $request = new TestRequest(); |
|
63 | - $response = $request->get(array('id' => 'geotag'), '/doku.php'); |
|
59 | + final public function test_indexed(): void |
|
60 | + { |
|
61 | + // render the page |
|
62 | + $request = new TestRequest(); |
|
63 | + $response = $request->get(array('id' => 'geotag'), '/doku.php'); |
|
64 | 64 | |
65 | - $this->assertEquals('52.132633;5.291266;9', $response->queryHTML('meta[name="geo.position"]')->attr('content')); |
|
66 | - // TODO test the geohash and index values |
|
67 | - } |
|
65 | + $this->assertEquals('52.132633;5.291266;9', $response->queryHTML('meta[name="geo.position"]')->attr('content')); |
|
66 | + // TODO test the geohash and index values |
|
67 | + } |
|
68 | 68 | } |
@@ -24,41 +24,41 @@ |
||
24 | 24 | class spatialhelper_plugin_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 | } |