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