xref: /plugin/dw2pdf/_test/DokuImageProcessorTest.php (revision 32ff69b6d150c9fcb79cd10b4d303f825b05eca0)
1*32ff69b6SAndreas Gohr<?php
2*32ff69b6SAndreas Gohr
3*32ff69b6SAndreas Gohrnamespace dokuwiki\plugin\dw2pdf\test;
4*32ff69b6SAndreas Gohr
5*32ff69b6SAndreas Gohruse dokuwiki\plugin\dw2pdf\DokuImageProcessorDecorator;
6*32ff69b6SAndreas Gohruse DokuWikiTest;
7*32ff69b6SAndreas Gohr
8*32ff69b6SAndreas Gohr/**
9*32ff69b6SAndreas Gohr * General tests for the imagemap plugin
10*32ff69b6SAndreas Gohr *
11*32ff69b6SAndreas Gohr * @group plugin_dw2pdf
12*32ff69b6SAndreas Gohr * @group plugins
13*32ff69b6SAndreas Gohr */
14*32ff69b6SAndreas Gohrclass DokuImageProcessorTest extends DokuWikiTest
15*32ff69b6SAndreas Gohr{
16*32ff69b6SAndreas Gohr
17*32ff69b6SAndreas Gohr    /**
18*32ff69b6SAndreas Gohr     * @return array the Testdata
19*32ff69b6SAndreas Gohr     */
20*32ff69b6SAndreas Gohr    public function provideGetImageTestdata() {
21*32ff69b6SAndreas Gohr        global $conf;
22*32ff69b6SAndreas Gohr
23*32ff69b6SAndreas Gohr        return [
24*32ff69b6SAndreas Gohr            [
25*32ff69b6SAndreas Gohr                DOKU_URL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif',
26*32ff69b6SAndreas Gohr                DOKU_REL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif',
27*32ff69b6SAndreas Gohr                'http://php.net/images/php.gif',
28*32ff69b6SAndreas Gohr                'http://php.net/images/php.gif',
29*32ff69b6SAndreas Gohr                'external image',
30*32ff69b6SAndreas Gohr            ],
31*32ff69b6SAndreas Gohr            [
32*32ff69b6SAndreas Gohr                DOKU_URL . 'lib/images/smileys/fixme.gif',
33*32ff69b6SAndreas Gohr                DOKU_REL . 'lib/images/smileys/fixme.gif',
34*32ff69b6SAndreas Gohr                DOKU_INC . 'lib/images/smileys/fixme.gif',
35*32ff69b6SAndreas Gohr                DOKU_INC . 'lib/images/smileys/fixme.gif',
36*32ff69b6SAndreas Gohr                'Replacement image / smiley',
37*32ff69b6SAndreas Gohr            ],
38*32ff69b6SAndreas Gohr            [
39*32ff69b6SAndreas Gohr                DOKU_URL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png',
40*32ff69b6SAndreas Gohr                DOKU_REL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png',
41*32ff69b6SAndreas Gohr                $conf['mediadir'] . '/wiki/dokuwiki-128.png',
42*32ff69b6SAndreas Gohr                $conf['mediadir'] . '/wiki/dokuwiki-128.png',
43*32ff69b6SAndreas Gohr                'Internal image',
44*32ff69b6SAndreas Gohr            ],
45*32ff69b6SAndreas Gohr        ];
46*32ff69b6SAndreas Gohr    }
47*32ff69b6SAndreas Gohr
48*32ff69b6SAndreas Gohr    /**
49*32ff69b6SAndreas Gohr     * @dataProvider provideGetImageTestdata
50*32ff69b6SAndreas Gohr     *
51*32ff69b6SAndreas Gohr     * @param $input_file
52*32ff69b6SAndreas Gohr     * @param $input_orig_srcpath
53*32ff69b6SAndreas Gohr     * @param $expected_file
54*32ff69b6SAndreas Gohr     * @param $expected_orig_srcpath
55*32ff69b6SAndreas Gohr     * @param $msg
56*32ff69b6SAndreas Gohr     */
57*32ff69b6SAndreas Gohr    public function testGetImage($input_file, $input_orig_srcpath, $expected_file, $expected_orig_srcpath, $msg)
58*32ff69b6SAndreas Gohr    {
59*32ff69b6SAndreas Gohr
60*32ff69b6SAndreas Gohr        list($actual_file, $actual_orig_srcpath) = DokuImageProcessorDecorator::adjustGetImageLinks($input_file,
61*32ff69b6SAndreas Gohr            $input_orig_srcpath);
62*32ff69b6SAndreas Gohr
63*32ff69b6SAndreas Gohr        $this->assertEquals($expected_file, $actual_file,  '$file ' . $msg);
64*32ff69b6SAndreas Gohr        $this->assertEquals($expected_orig_srcpath, $actual_orig_srcpath,  '$orig_srcpath ' . $msg);
65*32ff69b6SAndreas Gohr    }
66*32ff69b6SAndreas Gohr
67*32ff69b6SAndreas Gohr}
68