1
0
Fork 0
dokuwiki-plugins-extra/plugins/55/dw2pdf/_test/DokuImageProcessorTest.php
Daniel Baumann 8e32b01eb0
Adding dw2pdf version 2023-11-25 (48253f1).
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-03-24 19:33:13 +01:00

73 lines
2.2 KiB
PHP

<?php
namespace dokuwiki\plugin\dw2pdf\test;
use dokuwiki\plugin\dw2pdf\DokuImageProcessorDecorator;
use DokuWikiTest;
/**
* General tests for the imagemap plugin
*
* @group plugin_dw2pdf
* @group plugins
*/
class DokuImageProcessorTest extends DokuWikiTest
{
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
require_once __DIR__ . '/../vendor/autoload.php';
}
/**
* @return array the Testdata
*/
public function provideGetImageTestdata() {
global $conf;
return [
[
DOKU_URL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif',
DOKU_REL . 'lib/exe/fetch.php?tok=b0b7a3&media=http%3A%2F%2Fphp.net%2Fimages%2Fphp.gif',
'http://php.net/images/php.gif',
'http://php.net/images/php.gif',
'external image',
],
[
DOKU_URL . 'lib/images/throbber.gif',
DOKU_REL . 'lib/images/throbber.gif',
DOKU_INC . 'lib/images/throbber.gif',
DOKU_INC . 'lib/images/throbber.gif',
'fixed standard image',
],
[
DOKU_URL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png',
DOKU_REL . 'lib/exe/fetch.php?media=wiki:dokuwiki-128.png',
$conf['mediadir'] . '/wiki/dokuwiki-128.png',
$conf['mediadir'] . '/wiki/dokuwiki-128.png',
'Internal image',
],
];
}
/**
* @dataProvider provideGetImageTestdata
*
* @param $input_file
* @param $input_orig_srcpath
* @param $expected_file
* @param $expected_orig_srcpath
* @param $msg
*/
public function testGetImage($input_file, $input_orig_srcpath, $expected_file, $expected_orig_srcpath, $msg)
{
list($actual_file, $actual_orig_srcpath) = DokuImageProcessorDecorator::adjustGetImageLinks($input_file,
$input_orig_srcpath);
$this->assertEquals($expected_file, $actual_file, '$file ' . $msg);
$this->assertEquals($expected_orig_srcpath, $actual_orig_srcpath, '$orig_srcpath ' . $msg);
}
}