xref: /plugin/dw2pdf/_test/DokuImageProcessorTest.php (revision 99b678938172119a03be977293961083317b09d0)
132ff69b6SAndreas Gohr<?php
232ff69b6SAndreas Gohr
332ff69b6SAndreas Gohrnamespace dokuwiki\plugin\dw2pdf\test;
432ff69b6SAndreas Gohr
532ff69b6SAndreas Gohruse dokuwiki\plugin\dw2pdf\DokuImageProcessorDecorator;
632ff69b6SAndreas Gohruse DokuWikiTest;
732ff69b6SAndreas Gohr
832ff69b6SAndreas Gohr/**
932ff69b6SAndreas Gohr * General tests for the imagemap plugin
1032ff69b6SAndreas Gohr *
1132ff69b6SAndreas Gohr * @group plugin_dw2pdf
1232ff69b6SAndreas Gohr * @group plugins
1332ff69b6SAndreas Gohr */
1432ff69b6SAndreas Gohrclass DokuImageProcessorTest extends DokuWikiTest
1532ff69b6SAndreas Gohr{
1632ff69b6SAndreas Gohr
1732ff69b6SAndreas Gohr    /**
1832ff69b6SAndreas Gohr     * @return array the Testdata
1932ff69b6SAndreas Gohr     */
2032ff69b6SAndreas Gohr    public function provideGetImageTestdata() {
2132ff69b6SAndreas Gohr        global $conf;
2232ff69b6SAndreas Gohr
2332ff69b6SAndreas Gohr        return [
2432ff69b6SAndreas Gohr            [
2532ff69b6SAndreas Gohr                DOKU_URL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif',
2632ff69b6SAndreas Gohr                DOKU_REL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif',
2732ff69b6SAndreas Gohr                'http://php.net/images/php.gif',
2832ff69b6SAndreas Gohr                'http://php.net/images/php.gif',
2932ff69b6SAndreas Gohr                'external image',
3032ff69b6SAndreas Gohr            ],
3132ff69b6SAndreas Gohr            [
32*99b67893SAndreas Gohr                DOKU_URL . 'lib/images/throbber.gif',
33*99b67893SAndreas Gohr                DOKU_REL . 'lib/images/throbber.gif',
34*99b67893SAndreas Gohr                DOKU_INC . 'lib/images/throbber.gif',
35*99b67893SAndreas Gohr                DOKU_INC . 'lib/images/throbber.gif',
36*99b67893SAndreas Gohr                'fixed standard image',
3732ff69b6SAndreas Gohr            ],
3832ff69b6SAndreas Gohr            [
3932ff69b6SAndreas Gohr                DOKU_URL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png',
4032ff69b6SAndreas Gohr                DOKU_REL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png',
4132ff69b6SAndreas Gohr                $conf['mediadir'] . '/wiki/dokuwiki-128.png',
4232ff69b6SAndreas Gohr                $conf['mediadir'] . '/wiki/dokuwiki-128.png',
4332ff69b6SAndreas Gohr                'Internal image',
4432ff69b6SAndreas Gohr            ],
4532ff69b6SAndreas Gohr        ];
4632ff69b6SAndreas Gohr    }
4732ff69b6SAndreas Gohr
4832ff69b6SAndreas Gohr    /**
4932ff69b6SAndreas Gohr     * @dataProvider provideGetImageTestdata
5032ff69b6SAndreas Gohr     *
5132ff69b6SAndreas Gohr     * @param $input_file
5232ff69b6SAndreas Gohr     * @param $input_orig_srcpath
5332ff69b6SAndreas Gohr     * @param $expected_file
5432ff69b6SAndreas Gohr     * @param $expected_orig_srcpath
5532ff69b6SAndreas Gohr     * @param $msg
5632ff69b6SAndreas Gohr     */
5732ff69b6SAndreas Gohr    public function testGetImage($input_file, $input_orig_srcpath, $expected_file, $expected_orig_srcpath, $msg)
5832ff69b6SAndreas Gohr    {
5932ff69b6SAndreas Gohr
6032ff69b6SAndreas Gohr        list($actual_file, $actual_orig_srcpath) = DokuImageProcessorDecorator::adjustGetImageLinks($input_file,
6132ff69b6SAndreas Gohr            $input_orig_srcpath);
6232ff69b6SAndreas Gohr
6332ff69b6SAndreas Gohr        $this->assertEquals($expected_file, $actual_file,  '$file ' . $msg);
6432ff69b6SAndreas Gohr        $this->assertEquals($expected_orig_srcpath, $actual_orig_srcpath,  '$orig_srcpath ' . $msg);
6532ff69b6SAndreas Gohr    }
6632ff69b6SAndreas Gohr
6732ff69b6SAndreas Gohr}
68