1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/15538] Style inheritance for PNG and a default 'no icon'

PHPBB3-15538
This commit is contained in:
mrgoldy
2019-11-26 15:17:47 +01:00
parent 8bac1daba7
commit 5a1be4611c
2 changed files with 100 additions and 7 deletions

View File

@@ -40,7 +40,15 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
$auth->method('acl_get')
->willReturn(true);
$filesystem = new \phpbb\filesystem\filesystem();
$filesystem = $this->createMock('\phpbb\filesystem\filesystem');
$filesystem->expects($this->any())
->method('exists')
->with($this->stringContains('theme/icons/png/'))
->will($this->returnValueMap([
['phpBB/styles/chameleon/theme/icons/png/phone.png', true],
['phpBB/styles/chameleon/theme/icons/png/pencil.png', true],
['phpBB/styles/chameleon/theme/icons/png/user.png', false],
]));
$request = new phpbb_mock_request;
$symfony_request = new \phpbb\symfony_request(
$request
@@ -365,6 +373,21 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
],
'<img class="o-icon o-icon-png png-pencil my-class" src="phpBB/styles/chameleon/theme/icons/png/pencil.png" alt="Pencil icon" data-url="my-test-url/test-page.php?u=2" />',
],
/** PNG: Not found */
[
[
'type' => 'png',
'icon' => 'user',
'title' => 'ICON_USER',
'hidden' => false,
'classes' => 'my-class',
'attributes' => [],
],
[
'ICON_USER' => 'User icon',
],
'<img class="o-icon o-icon-png png-404 my-class" src="phpBB/styles/chameleon/theme/icons/png/404.png" alt="User icon" />',
],
/** SVG: default */
[
[
@@ -405,6 +428,19 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
<path d="M0 0h24v24H0z" fill="none"></path>
</svg>',
],
/** SVG: Not found */
[
[
'type' => 'svg',
'icon' => 'not-existent',
'title' => 'Just a title',
'hidden' => false,
'classes' => '',
'attributes' => [],
],
[],
'<img class="o-icon o-icon-png png-404" src="phpBB/styles/chameleon/theme/icons/png/404.png" alt="Just a title" />',
],
/** SVG: Sanitization */
[
[