Completed
Pull Request — master (#54)
by Mark
19s
created
_test/index.test.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -15,95 +15,95 @@
 block discarded – undo
15 15
 class index_test extends DokuWikiTest
16 16
 {
17 17
 
18
-    protected $pluginsEnabled = array('spatialhelper');
19
-
20
-    /**
21
-     * copy data and add pages to the index.
22
-     */
23
-    public static function setUpBeforeClass(): void
24
-    {
25
-        parent::setUpBeforeClass();
26
-        global $conf;
27
-        $conf['allowdebug'] = 1;
28
-
29
-        TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/');
30
-    }
31
-
32
-    /**
33
-     * Test data provider.
34
-     * @see index_test::test_convertDMStoD
35
-     *
36
-     * @return array
37
-     * @see index_test::test_convertDMStoD
38
-     */
39
-    final public static function convertDMStoDTestdata(): array
40
-    {
41
-        return array(
42
-            array(
43
-                array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',),
44
-                52.5172,
45
-                'Latitude in Europe'
46
-            ),
47
-            array(
48
-                array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',),
49
-                13.5105,
50
-                'Longitude in Europe'
51
-            ),
52
-            array(
53
-                array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',),
54
-                50.5708,
55
-                'Latitude in North America'
56
-            ),
57
-            array(
58
-                array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',),
59
-                -109.4673,
60
-                'Longitude in North America'
61
-            ),
62
-        );
63
-    }
64
-
65
-    final public function setUp(): void
66
-    {
67
-        parent::setUp();
68
-
69
-        global $conf;
70
-        $conf['allowdebug'] = 1;
71
-        $conf['cachetime'] = -1;
72
-    }
73
-
74
-    /**
75
-     * @dataProvider convertDMStoDTestdata
76
-     */
77
-    final public function test_convertDMStoD(array $input, float $expected_output, string $msg): void
78
-    {
79
-        $index = plugin_load('helper', 'spatialhelper_index');
80
-        assert($index instanceof helper_plugin_spatialhelper_index);
81
-
82
-        $actual_output = $index->convertDMStoD($input);
83
-
84
-        self::assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg);
85
-    }
86
-
87
-    final public function test_ImageWithoutGeotag(): void
88
-    {
89
-        $index = plugin_load('helper', 'spatialhelper_index');
90
-        assert($index instanceof helper_plugin_spatialhelper_index);
91
-
92
-        $actual_output = $index->getCoordsFromExif(':vesder_eupen_no_gps.jpg');
93
-        self::assertFalse($actual_output, 'Expected no geotag to be found');
94
-    }
95
-
96
-    final public function test_ImageWithGeotag(): void
97
-    {
98
-        $index = plugin_load('helper', 'spatialhelper_index');
99
-        assert($index instanceof helper_plugin_spatialhelper_index);
100
-
101
-        // lat/lon: 37°4'36.12",31°39'21.96" or x/y: 31.6561,37.0767
102
-        $actual_output = $index->getCoordsFromExif(':manavgat_restaurant_handost_with_gps.jpg');
103
-
104
-        self::assertNotNull($actual_output, 'Expected a geotag to be found');
105
-        self::assertNotFalse($actual_output, 'Expected a geotag to be found');
106
-        self::assertEqualsWithDelta(31.6561, $actual_output->x(), 0.0001);
107
-        self::assertEqualsWithDelta(37.0767, $actual_output->y(), 0.0001);
108
-    }
18
+	protected $pluginsEnabled = array('spatialhelper');
19
+
20
+	/**
21
+	 * copy data and add pages to the index.
22
+	 */
23
+	public static function setUpBeforeClass(): void
24
+	{
25
+		parent::setUpBeforeClass();
26
+		global $conf;
27
+		$conf['allowdebug'] = 1;
28
+
29
+		TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/');
30
+	}
31
+
32
+	/**
33
+	 * Test data provider.
34
+	 * @see index_test::test_convertDMStoD
35
+	 *
36
+	 * @return array
37
+	 * @see index_test::test_convertDMStoD
38
+	 */
39
+	final public static function convertDMStoDTestdata(): array
40
+	{
41
+		return array(
42
+			array(
43
+				array(0 => '52/1', 1 => '31/1', 2 => '2/1', 3 => 'N',),
44
+				52.5172,
45
+				'Latitude in Europe'
46
+			),
47
+			array(
48
+				array(0 => '13/1', 1 => '30/1', 2 => '38/1', 3 => 'E',),
49
+				13.5105,
50
+				'Longitude in Europe'
51
+			),
52
+			array(
53
+				array(0 => '50/1', 1 => '34251480/1000000', 2 => '0/1', 3 => 'N',),
54
+				50.5708,
55
+				'Latitude in North America'
56
+			),
57
+			array(
58
+				array(0 => '109/1', 1 => '28041300/1000000', 2 => '0/1', 3 => 'W',),
59
+				-109.4673,
60
+				'Longitude in North America'
61
+			),
62
+		);
63
+	}
64
+
65
+	final public function setUp(): void
66
+	{
67
+		parent::setUp();
68
+
69
+		global $conf;
70
+		$conf['allowdebug'] = 1;
71
+		$conf['cachetime'] = -1;
72
+	}
73
+
74
+	/**
75
+	 * @dataProvider convertDMStoDTestdata
76
+	 */
77
+	final public function test_convertDMStoD(array $input, float $expected_output, string $msg): void
78
+	{
79
+		$index = plugin_load('helper', 'spatialhelper_index');
80
+		assert($index instanceof helper_plugin_spatialhelper_index);
81
+
82
+		$actual_output = $index->convertDMStoD($input);
83
+
84
+		self::assertEqualsWithDelta($expected_output, $actual_output, 0.0001, $msg);
85
+	}
86
+
87
+	final public function test_ImageWithoutGeotag(): void
88
+	{
89
+		$index = plugin_load('helper', 'spatialhelper_index');
90
+		assert($index instanceof helper_plugin_spatialhelper_index);
91
+
92
+		$actual_output = $index->getCoordsFromExif(':vesder_eupen_no_gps.jpg');
93
+		self::assertFalse($actual_output, 'Expected no geotag to be found');
94
+	}
95
+
96
+	final public function test_ImageWithGeotag(): void
97
+	{
98
+		$index = plugin_load('helper', 'spatialhelper_index');
99
+		assert($index instanceof helper_plugin_spatialhelper_index);
100
+
101
+		// lat/lon: 37°4'36.12",31°39'21.96" or x/y: 31.6561,37.0767
102
+		$actual_output = $index->getCoordsFromExif(':manavgat_restaurant_handost_with_gps.jpg');
103
+
104
+		self::assertNotNull($actual_output, 'Expected a geotag to be found');
105
+		self::assertNotFalse($actual_output, 'Expected a geotag to be found');
106
+		self::assertEqualsWithDelta(31.6561, $actual_output->x(), 0.0001);
107
+		self::assertEqualsWithDelta(37.0767, $actual_output->y(), 0.0001);
108
+	}
109 109
 }
Please login to merge, or discard this patch.
_test/indexing.test.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -27,57 +27,57 @@
 block discarded – undo
27 27
 class indexing_test extends DokuWikiTest
28 28
 {
29 29
 
30
-    protected $pluginsEnabled = array('geotag', 'geophp', 'spatialhelper');
30
+	protected $pluginsEnabled = array('geotag', 'geophp', 'spatialhelper');
31 31
 
32
-    /**
33
-     * copy data and add pages to the index.
34
-     */
35
-    public static function setUpBeforeClass(): void
36
-    {
37
-        parent::setUpBeforeClass();
38
-        TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/');
39
-    }
32
+	/**
33
+	 * copy data and add pages to the index.
34
+	 */
35
+	public static function setUpBeforeClass(): void
36
+	{
37
+		parent::setUpBeforeClass();
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['dontlog'] = [];
48
-        $conf['cachetime'] = -1;
45
+		global $conf;
46
+		$conf['allowdebug'] = 1;
47
+		$conf['dontlog'] = [];
48
+		$conf['cachetime'] = -1;
49 49
 
50
-        idx_addPage('geotag', true, true);
51
-    }
50
+		idx_addPage('geotag', true, true);
51
+	}
52 52
 
53
-    /**
54
-     * @throws Exception if anything goes wrong
55
-     */
56
-    final public function testIndexed(): void
57
-    {
58
-        $indexer = plugin_load('helper', 'spatialhelper_index');
59
-        $this->assertInstanceOf('helper_plugin_spatialhelper_index', $indexer);
60
-        $this->assertTrue($indexer->updateSpatialIndex('geotag'));
53
+	/**
54
+	 * @throws Exception if anything goes wrong
55
+	 */
56
+	final public function testIndexed(): void
57
+	{
58
+		$indexer = plugin_load('helper', 'spatialhelper_index');
59
+		$this->assertInstanceOf('helper_plugin_spatialhelper_index', $indexer);
60
+		$this->assertTrue($indexer->updateSpatialIndex('geotag'));
61 61
 
62
-        // render the page
63
-        $request = new TestRequest();
64
-        $response = $request->get(array('id' => 'geotag'), '/doku.php');
62
+		// render the page
63
+		$request = new TestRequest();
64
+		$response = $request->get(array('id' => 'geotag'), '/doku.php');
65 65
 
66
-        // test metadata
67
-        $this->assertEquals(
68
-            '52.132633;5.291266;9',
69
-            $response->queryHTML('meta[name="geo.position"]')->attr('content')
70
-        );
71
-        $this->assertEquals(
72
-            '52.132633, 5.291266',
73
-            $response->queryHTML('meta[name="ICBM"]')->attr('content')
74
-        );
66
+		// test metadata
67
+		$this->assertEquals(
68
+			'52.132633;5.291266;9',
69
+			$response->queryHTML('meta[name="geo.position"]')->attr('content')
70
+		);
71
+		$this->assertEquals(
72
+			'52.132633, 5.291266',
73
+			$response->queryHTML('meta[name="ICBM"]')->attr('content')
74
+		);
75 75
 
76
-        // TODO / WIP test the geohash and index values
77
-        $this->assertStringStartsWith(
78
-        // u17b86kyx7j
79
-            'u17b86k',
80
-            $response->queryHTML('meta[name="geo.hash"]')->attr('content')
81
-        );
82
-    }
76
+		// TODO / WIP test the geohash and index values
77
+		$this->assertStringStartsWith(
78
+		// u17b86kyx7j
79
+			'u17b86k',
80
+			$response->queryHTML('meta[name="geo.hash"]')->attr('content')
81
+		);
82
+	}
83 83
 }
Please login to merge, or discard this patch.