19 declare(strict_types=1);
    21 require_once(
"vendor/composer/vendor/autoload.php");
    22 require_once(__DIR__ . 
"/../../../Base.php");
    33     public const ICON_PATH = __DIR__ . 
'/../../../../../../../public/assets/images/standard/';
    38         return new I\Component\Symbol\Icon\Factory();
    44         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Icon\\Factory", 
$f);
    46         $si = 
$f->standard(
'course', 
'Kurs');
    47         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Icon\\Standard", $si);
    49         $ci = 
$f->custom(
'course', 
'Kurs');
    50         $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Icon\\Custom", $ci);
    57         $ico = 
$f->standard(
'course', 
'Kurs');
    58         $this->assertEquals(
'Kurs', $ico->getLabel());
    59         $this->assertEquals(
'course', $ico->getName());
    60         $this->assertEquals(
'small', $ico->getSize());
    61         $this->assertEquals(
false, $ico->isDisabled());
    63         $this->assertNull($ico->getAbbreviation());
    65         $ico = $ico->withAbbreviation(
'K');
    66         $this->assertEquals(
'K', $ico->getAbbreviation());
    72         $ico = 
$f->standard(
'course', 
'Kurs');
    74         $ico = $ico->withSize(
'medium');
    75         $this->assertEquals(
'medium', $ico->getSize());
    77         $ico = $ico->withSize(
'large');
    78         $this->assertEquals(
'large', $ico->getSize());
    80         $ico = $ico->withSize(
'small');
    81         $this->assertEquals(
'small', $ico->getSize());
    88             $ico = 
$f->standard(
'course', 
'Kurs');
    89             $ico->withSize(
'tiny');
    90             $this->assertFalse(
"This should not happen");
    92             $this->assertTrue(
true);
    99         $ico = 
$f->standard(
'course', 
'Kurs');
   101         $ico = $ico->withDisabled(
false);
   102         $this->assertEquals(
false, $ico->isDisabled());
   104         $ico = $ico->withDisabled(
true);
   105         $this->assertEquals(
true, $ico->isDisabled());
   111         $ico = 
$f->standard(
'course', 
'Kurs');
   112         $this->expectException(TypeError::class);
   113         $ico->withDisabled(
'true');
   120         $ico = 
$f->custom(
'/some/path/', 
'Custom Icon');
   121         $this->assertEquals(
'/some/path/', $ico->getIconPath());
   126         $ico = $this->
getIconFactory()->standard(
'crs', 
'Course', 
'medium');
   127         $html = $this->normalizeHTML($this->getDefaultRenderer()->render($ico));
   128         $path = self::ICON_PATH_REL . 
'standard/icon_crs.svg';
   129         $expected = 
"<img class=\"icon crs medium\" src=\"$path\" alt=\"Course\"/>";
   130         $this->assertEquals($expected, $html);
   140         $html = $this->normalizeHTML($this->getDefaultRenderer()->render($ico));
   141         $path = self::ICON_PATH_REL . 
'standard/icon_crs.svg';
   142         $expected = 
"<img class=\"icon crs medium disabled\" src=\"$path\" alt=\"Course\" aria-disabled=\"true\"/>";
   143         $this->assertEquals($expected, $html);
   152         $html = $this->normalizeHTML($this->getDefaultRenderer()->render($ico));
   153         $expected = <<<imgtag
   154 <img 
class=
"icon crs medium" src=
"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDMyMCAzMjAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyMCAzMjA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtjbGlwLXBhdGg6dXJsKCNTVkdJRF8wMDAwMDA4MDE3OTA3MDMwNjQ3MTMxMjU3MDAwMDAwNzg1OTYxOTkxMTQ1NzE1MjM5MV8pO2ZpbGw6IzRDNjU4Njt9DQoJLnN0MXtmaWxsOm5vbmU7fQ0KPC9zdHlsZT4NCjxnPg0KCTxnPg0KCQk8ZGVmcz4NCgkJCTxyZWN0IGlkPSJTVkdJRF8xXyIgeD0iNTUiIHk9IjQwIiB3aWR0aD0iMjEwIiBoZWlnaHQ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AgIGZvbnQtc3R5bGU6bm9ybWFsOwogICAgICBmb250LXdlaWdodDpub3JtYWw7CiAgICAgIGZvbnQtc2l6ZTo4cmVtOwogICAgICBmb250LWZhbWlseTpzYW5zLXNlcmlmOwogICAgICBsZXR0ZXItc3BhY2luZzowcHg7CiAgICAgIGZpbGw6IzAwMDsKICAgICAgZmlsbC1vcGFjaXR5OjE7CiAgICAiCiAgICB4PSI1MCUiCiAgICB5PSI1NSUiCiAgICBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIgogICAgdGV4dC1hbmNob3I9Im1pZGRsZSIKICA+Q1JTPC90ZXh0Pjwvc3ZnPg==" alt=
"Course" data-abbreviation=
"CRS"/>
   156         $this->assertEquals(trim($expected), trim($html));
   161         $path = 
'./assets/images/standard/icon_fold.svg';
   163         $html = $this->normalizeHTML($this->getDefaultRenderer()->render($ico));
   164         $expected = 
'<img class="icon custom medium" src="./assets/images/standard/icon_fold.svg" alt="Custom"/>';
   165         $this->assertEquals($expected, $html);
   172         $default_icons_abr = 
$f->standard(
"nothing", 
"nothing")->getAllStandardHandles();
   174         foreach ($default_icons_abr as $icon_abr) {
   175             $path = self::ICON_PATH . 
"icon_" . $icon_abr . 
".svg";
   176             $this->assertTrue(file_exists(
$path), 
"Missing Standard Icon: " . 
$path);
   185         $ico = $ico->withAdditionalOnLoadCode(
function (
$id) {
   188         $html = $this->normalizeHTML($this->getDefaultRenderer()->render($ico));
   189         $path = self::ICON_PATH_REL . 
'standard/icon_crs.svg';
   190         $expected = 
"<img  aria-disabled=\"true\"/>";
   191         $expected = $this->normalizeHTML(
"<img id=\"id_1\" class=\"icon crs medium\" src=\"$path\" alt=\"Course\"/>");
   192         $this->assertEquals($expected, $html);
   197         $path = 
'./assets/images/icon_fold.svg';
   199         $ico->setLabel(
"New Custom Icon Label");
   200         $html = $this->normalizeHTML($this->getDefaultRenderer()->render($ico));
   201         $expected = 
'<img class="icon custom medium" src="./assets/images/icon_fold.svg" alt="New Custom Icon Label"/>';
   202         $this->assertEquals($expected, $html);
   209         $ico = $this->
getIconFactory()->standard(
'<h1>name</h1>', 
'label');
   210         $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($ico));
   211         $expected = 
'<img class="icon <h1>name</h1> small" src="./assets/images/standard/icon_default.svg" alt="label"/>';
   212         $this->assertEquals($expected, $html);
   217         $ico = $this->
getIconFactory()->standard(
'name', 
'<h1>label</h1>');
   218         $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($ico));
   219         $expected = 
'<img class="icon name small" src="./assets/images/standard/icon_default.svg" alt="<h1>label</h1>"/>';
   220         $this->assertEquals($expected, $html);
   228         $ico = $this->
getIconFactory()->standard(
'name', 
'label')->withAbbreviation(
'<h1>abbreviation</h1>');
   229         $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($ico));
   230         $expected = 
'<img class="icon name small" src="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDMyMCAzMjAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyMCAzMjA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtjbGlwLXBhdGg6dXJsKCNTVkdJRF8wMDAwMDA0Nzc1MTgzNzAxNzcyMjkwMzQ5MDAwMDAwOTM5MjQyNjM5Mzc4Mzc4Mzg1N18pO2ZpbGw6IzRDNjU4Njt9DQo8L3N0eWxlPg0KPGc+DQoJPGc+DQoJCTxkZWZzPg0KCQkJPHJlY3QgaWQ9IlNWR0lEXzFfIiB3aWR0aD0iMzIwIiBoZWlnaHQ9IjMyMCIvPg0KCQk8L2RlZnM+D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         $this->assertEquals($expected, $html);
   237         $html = $this->brutallyTrimHTML($this->getDefaultRenderer()->render($ico));
   238         $expected = 
'<img class="icon custom small" src="<h1>path</h1>" alt="label"/>';
   239         $this->assertEquals($expected, $html);
 testDisabledModificationWrongParam()
 
testDisabledModification()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
testRenderingStandardJSBindable($ico)
testRenderingStandard 
 
testRenderingStandardAbbreviation(Standard $ico)
testRenderingStandard 
 
withAbbreviation(string $abbreviation)
Set the abbreviation for this icon. 
 
withDisabled(bool $is_disabled)
Get an icon like this, but marked as disabled. 
 
testSizeModificationWrongParam()
 
testAllStandardIconsExist()
 
Test on icon implementation. 
 
This describes the specific behavior of an ILIAS standard icon. 
 
testRenderingStandardDisabled(Standard $ico)
testRenderingStandard 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
testHTMLInAbbreviation()
testRenderingStandard