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{ 16*0e451a24SAndreas Gohr public static function setUpBeforeClass(): void 17*0e451a24SAndreas Gohr { 18*0e451a24SAndreas Gohr parent::setUpBeforeClass(); 19*0e451a24SAndreas Gohr require_once __DIR__ . '/../vendor/autoload.php'; 20*0e451a24SAndreas Gohr } 21*0e451a24SAndreas Gohr 2232ff69b6SAndreas Gohr 2332ff69b6SAndreas Gohr /** 2432ff69b6SAndreas Gohr * @return array the Testdata 2532ff69b6SAndreas Gohr */ 2632ff69b6SAndreas Gohr public function provideGetImageTestdata() { 2732ff69b6SAndreas Gohr global $conf; 2832ff69b6SAndreas Gohr 2932ff69b6SAndreas Gohr return [ 3032ff69b6SAndreas Gohr [ 3132ff69b6SAndreas Gohr DOKU_URL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif', 3232ff69b6SAndreas Gohr DOKU_REL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif', 3332ff69b6SAndreas Gohr 'http://php.net/images/php.gif', 3432ff69b6SAndreas Gohr 'http://php.net/images/php.gif', 3532ff69b6SAndreas Gohr 'external image', 3632ff69b6SAndreas Gohr ], 3732ff69b6SAndreas Gohr [ 3899b67893SAndreas Gohr DOKU_URL . 'lib/images/throbber.gif', 3999b67893SAndreas Gohr DOKU_REL . 'lib/images/throbber.gif', 4099b67893SAndreas Gohr DOKU_INC . 'lib/images/throbber.gif', 4199b67893SAndreas Gohr DOKU_INC . 'lib/images/throbber.gif', 4299b67893SAndreas Gohr 'fixed standard image', 4332ff69b6SAndreas Gohr ], 4432ff69b6SAndreas Gohr [ 4532ff69b6SAndreas Gohr DOKU_URL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png', 4632ff69b6SAndreas Gohr DOKU_REL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png', 4732ff69b6SAndreas Gohr $conf['mediadir'] . '/wiki/dokuwiki-128.png', 4832ff69b6SAndreas Gohr $conf['mediadir'] . '/wiki/dokuwiki-128.png', 4932ff69b6SAndreas Gohr 'Internal image', 5032ff69b6SAndreas Gohr ], 5132ff69b6SAndreas Gohr ]; 5232ff69b6SAndreas Gohr } 5332ff69b6SAndreas Gohr 5432ff69b6SAndreas Gohr /** 5532ff69b6SAndreas Gohr * @dataProvider provideGetImageTestdata 5632ff69b6SAndreas Gohr * 5732ff69b6SAndreas Gohr * @param $input_file 5832ff69b6SAndreas Gohr * @param $input_orig_srcpath 5932ff69b6SAndreas Gohr * @param $expected_file 6032ff69b6SAndreas Gohr * @param $expected_orig_srcpath 6132ff69b6SAndreas Gohr * @param $msg 6232ff69b6SAndreas Gohr */ 6332ff69b6SAndreas Gohr public function testGetImage($input_file, $input_orig_srcpath, $expected_file, $expected_orig_srcpath, $msg) 6432ff69b6SAndreas Gohr { 6532ff69b6SAndreas Gohr 6632ff69b6SAndreas Gohr list($actual_file, $actual_orig_srcpath) = DokuImageProcessorDecorator::adjustGetImageLinks($input_file, 6732ff69b6SAndreas Gohr $input_orig_srcpath); 6832ff69b6SAndreas Gohr 6932ff69b6SAndreas Gohr $this->assertEquals($expected_file, $actual_file, '$file ' . $msg); 7032ff69b6SAndreas Gohr $this->assertEquals($expected_orig_srcpath, $actual_orig_srcpath, '$orig_srcpath ' . $msg); 7132ff69b6SAndreas Gohr } 7232ff69b6SAndreas Gohr 7332ff69b6SAndreas Gohr} 74