19 declare(strict_types=1);
    35     protected $path = 
'sample/path';
    41         $custom_icon = $this->createMock(Custom::class);
    42         $custom_icon->method(
'getIconPath')
    43                     ->willReturn($this->path);
    44         $custom_icon->method(
'getSize')
    45                     ->willReturn($this->size);
    46         $custom_icon->method(
'getLabel')
    47                     ->willReturn($this->alt);
    49         $icon_factory = $this->createMock(IconFactory::class);
    50         $icon_factory->method(
'custom')
    51                      ->willReturn($custom_icon);
    53         $symbol_factory = $this->createMock(SymbolFactory::class);
    54         $symbol_factory->method(
'icon')
    55                        ->willReturn($icon_factory);
    57         $factory = $this->createMock(UIFactory::class);
    58         $factory->method(
'symbol')
    59                 ->willReturn($symbol_factory);
    66         $renderer = $this->createMock(UIRenderer::class);
    68                  ->willReturnCallback(
function ($arg) {
    69                      return 'rendered: path(' . $arg->getIconPath() .
    70                          '), alt(' . $arg->getLabel() .
    71                          '), size(' . $arg->getSize() . 
')';
    94         $this->assertSame($short1, $short2);
    95         $this->assertSame($long1, $long2);
    96         $this->assertSame($scorm1, $scorm2);
    98         $this->assertNotSame($long1, $short1);
    99         $this->assertNotSame($long1, $scorm1);
   100         $this->assertNotSame($short1, $scorm1);
   102         return [
'long' => $long1, 
'short' => $short1, 
'scorm' => $scorm1];
   107         $renderer = $this->getMockBuilder(UIRenderer::class)
   108                          ->disableOriginalConstructor()
   111         $factory = $this->getMockBuilder(UIFactory::class)
   112                         ->disableOriginalConstructor()
   115         $this->expectException(ilLPException::class);
   125         $path1 = $instances[
'long']->getImagePathInProgress();
   127         $this->assertSame($path1, $path2);
   129         $path1 = $instances[
'short']->getImagePathCompleted();
   131         $this->assertSame($path1, $path2);
   133         $path1 = $instances[
'scorm']->getImagePathFailed();
   135         $this->assertSame($path1, $path2);
   144         $this->expectException(ilLPException::class);
   145         $instances[
'long']->getImagePathRunning();
   154         $this->expectException(ilLPException::class);
   155         $instances[
'long']->getImagePathAsset();
   166             'rendered: path(' . $this->path .
   167             '), alt(' . $this->alt .
   168             '), size(' . $this->size . 
')',
   169             $instances[
'long']->renderIcon($this->path, $this->alt)
   173             'rendered: path(' . $this->path .
   174             '), alt(' . $this->alt .
   175             '), size(' . $this->size . 
')',
   176             $instances[
'short']->renderIcon($this->path, $this->alt)
   186         $this->expectException(ilLPException::class);
   187         $instances[
'scorm']->renderIcon(
'path', 
'alt');
   198         return 'test/' . $image_name;
 const LP_STATUS_COMPLETED_NUM
 
testRenderScormIcons(array $instances)
testTripleton 
 
testImagePathRunningForLongVariant(array $instances)
testTripleton 
 
buildImagePath(string $image_name)
 
testImagePathAssetForLongVariant(array $instances)
testTripleton 
 
Mocks out calls to ilUtil::getImagePath. 
 
const LP_STATUS_IN_PROGRESS_NUM
 
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
 
testSomeExamplesForImagePathsByStatus(array $instances)
testTripleton 
 
This is how a factory for icons looks like. 
 
Unit tests for class ilLPStatusIcons. 
 
testGetInstanceForInvalidVariant()
 
testSomeExamplesForRenderedIcons(array $instances)
testTripleton 
 
const LP_STATUS_FAILED_NUM