mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 00:07:44 +02:00
[ticket/17283] Remove remaining parts using iconify
PHPBB3-17283
This commit is contained in:
@@ -1,143 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\tests\unit\assets;
|
||||
|
||||
class iconify_bundler_test extends \phpbb_test_case
|
||||
{
|
||||
/** @var array Log content */
|
||||
protected $log_content = [];
|
||||
|
||||
/** @var \phpbb\assets\iconify_bundler */
|
||||
protected $bundler;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path;
|
||||
|
||||
$log = $this->getMockBuilder('\phpbb\log\dummy')
|
||||
->onlyMethods(['add'])
|
||||
->getMock();
|
||||
$log->method('add')
|
||||
->willReturnCallback(function ($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()) {
|
||||
$this->log_content[] = $log_operation;
|
||||
});
|
||||
|
||||
$this->bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
}
|
||||
|
||||
public function data_test_generate_bundle()
|
||||
{
|
||||
return [
|
||||
[
|
||||
['fa:address-card-o'],
|
||||
['"prefix":"fa"', '"address-card-o"'],
|
||||
],
|
||||
[
|
||||
['fa:address-card-o', 'ic:baseline-credit-card'],
|
||||
['"prefix":"fa"', '"address-card-o"', '"prefix":"ic"', '"baseline-credit-card"'],
|
||||
],
|
||||
[
|
||||
['fa:address-card-o', 'fa:foo-bar'],
|
||||
['"prefix":"fa"', '"address-card-o"'],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
['fa:address-card-o', 'ic:baseline-credit-card', 'ic:baseline-credit-card'],
|
||||
['"prefix":"fa"', '"address-card-o"', '"prefix":"ic"', '"baseline-credit-card"'],
|
||||
],
|
||||
[
|
||||
['fa:address-card-o', 'ic:baseline-credit-card', 'ic:baseline-add-ic-call'],
|
||||
['"prefix":"fa"', '"address-card-o"', '"prefix":"ic"', '"baseline-credit-card"', '"baseline-add-ic-call"'],
|
||||
],
|
||||
[
|
||||
['fa:address-card-o', 'fa:bell', 'ic:baseline-credit-card', 'ic:baseline-add-ic-call'],
|
||||
['"prefix":"fa"', '"address-card-o"', '"bell"', '"prefix":"ic"', '"baseline-credit-card"', '"baseline-add-ic-call"'],
|
||||
],
|
||||
[
|
||||
['@test'],
|
||||
[],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
['fa:address-foo-o'],
|
||||
['"prefix":"fa"', '"icons":[]'],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
['foo:bar'],
|
||||
[],
|
||||
['LOG_ICON_COLLECTION_INVALID']
|
||||
],
|
||||
[
|
||||
['@iconify:fa:address-card-o'],
|
||||
['"prefix":"fa"', '"address-card-o"'],
|
||||
],
|
||||
[
|
||||
['@iconify:someother:fa:address-card-o'],
|
||||
[],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
['iconify:fa:address-card-o'],
|
||||
['"prefix":"fa"', '"address-card-o"'],
|
||||
],
|
||||
[
|
||||
['iconify:fa:fa:address-card-o'],
|
||||
[],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
['test'],
|
||||
[],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
[''],
|
||||
[],
|
||||
['LOG_ICON_INVALID'],
|
||||
],
|
||||
[
|
||||
['fa-address-card-o'],
|
||||
['"prefix":"fa"', '"address-card-o"'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider data_test_generate_bundle
|
||||
*/
|
||||
public function test_generate_bundle($icons, $expected, $log_content = [])
|
||||
{
|
||||
$this->bundler->add_icons($icons);
|
||||
$bundle = $this->bundler->run();
|
||||
foreach ($expected as $expected_part)
|
||||
{
|
||||
$this->assertStringContainsString($expected_part, $bundle, 'Failed asserting that generated bundle contains ' . $expected_part);
|
||||
}
|
||||
|
||||
if (!count($expected))
|
||||
{
|
||||
$this->assertEquals($bundle, '', 'Failed asserting that generated bundle is empty');
|
||||
}
|
||||
|
||||
if (count($log_content))
|
||||
{
|
||||
$this->assertEquals($this->log_content, $log_content, 'Failed asserting that log content is correct');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertEmpty($this->log_content, 'Failed asserting that log content is empty');
|
||||
}
|
||||
}
|
||||
}
|
@@ -117,8 +117,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
||||
$container->setParameter('core.environment', PHPBB_ENVIRONMENT);
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
|
@@ -67,8 +67,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
|
||||
$phpbb_container->set('ext.manager', $extension_manager);
|
||||
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$phpbb_container->set('assets.bag', $assets_bag);
|
||||
|
||||
$context = new \phpbb\template\context();
|
||||
|
@@ -67,8 +67,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||
$this->phpEx
|
||||
);
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $this->phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$this->config,
|
||||
|
@@ -96,8 +96,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader([]);
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
@@ -59,8 +59,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
@@ -153,8 +153,7 @@ Zeta test event in all',
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
@@ -45,8 +45,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
@@ -96,8 +96,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
@@ -46,8 +46,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
@@ -64,8 +64,7 @@ class twig_test extends \phpbb_test_case
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
$log = new \phpbb\log\dummy();
|
||||
$iconify_bundler = new \phpbb\assets\iconify_bundler($log, $phpbb_root_path);
|
||||
$assets_bag = new \phpbb\template\assets_bag($iconify_bundler);
|
||||
$assets_bag = new \phpbb\template\assets_bag();
|
||||
$twig = new \phpbb\template\twig\environment(
|
||||
$assets_bag,
|
||||
$config,
|
||||
|
Reference in New Issue
Block a user