xref: /plugin/siteexport/_test/plugin_siteexport_functions_getrelativeurl.test.php (revision 3f2e6413e4fcb90b51f776922c6738d8025c6aaa)
1<?php
2
3/**
4 * @group plugin_siteexport
5 * @group plugin_siteexport_functions
6 */
7class SiteexportFunctionsGetRelativeURLTest extends DokuWikiTest {
8
9    protected $pluginsEnabled = array('siteexport');
10
11    function testAbsolute() {
12
13        $functions = new siteexport_functions();
14
15        $testMatrix = array(
16
17            array(
18                'base'      => "test.html",
19                'relative'  => "test2.html",
20                'expected'  => "test2.html",
21            ),
22
23            array(
24                'base'      => "test/test.html",
25                'relative'  => "test/test2.html",
26                'expected'  => "test2.html",
27            ),
28
29        );
30
31        foreach($testMatrix as $test) {
32            $result = $functions->getRelativeURL($test['relative'], $test['base']);
33            $this->assertTrue($test['expected'] == $result, "Result '{$result}' did not match expected result '{$test['expected']}' (base: '{$test['base']}', relative: '{$test['relative']}')");
34        }
35    }
36}
37