3 declare(strict_types=1);
34 protected $path =
'sample/path';
43 $utilMock = Mockery::mock(
'alias:' . ilUtil::class);
44 $utilMock->shouldReceive(
'getImagePath')
45 ->with(Mockery::type(
'string'))
46 ->andReturnUsing(
function ($arg) {
47 return 'test/' . $arg;
50 $renderer = Mockery::mock(Renderer::class);
51 $renderer->shouldReceive(
'render')
52 ->andReturnUsing(
function ($arg1) {
53 return 'rendered: path(' . $arg1->getIconPath() .
54 '), alt(' . $arg1->getLabel() .
55 '), size(' . $arg1->getSize() .
')';
58 $custom_icon = Mockery::mock(Custom::class);
59 $custom_icon->shouldReceive(
'getIconPath')
60 ->andReturn($this->path);
61 $custom_icon->shouldReceive(
'getSize')
62 ->andReturn($this->size);
63 $custom_icon->shouldReceive(
'getLabel')
64 ->andReturn($this->alt);
66 $factory = Mockery::mock(Factory::class);
67 $factory->shouldReceive(
'symbol->icon->custom')
68 ->andReturn($custom_icon);
79 $this->assertSame($short1, $short2);
80 $this->assertSame($long1, $long2);
81 $this->assertSame($scorm1, $scorm2);
83 $this->assertNotSame($long1, $short1);
84 $this->assertNotSame($long1, $scorm1);
85 $this->assertNotSame($short1, $scorm1);
87 return [
'long' => $long1,
'short' => $short1,
'scorm' => $scorm1];
92 $renderer = $this->getMockBuilder(Renderer::class)
93 ->disableOriginalConstructor()
96 $factory = $this->getMockBuilder(Factory::class)
97 ->disableOriginalConstructor()
100 $this->expectException(ilLPException::class);
110 $path1 = $instances[
'long']->getImagePathInProgress();
112 $this->assertSame($path1, $path2);
114 $path1 = $instances[
'short']->getImagePathCompleted();
116 $this->assertSame($path1, $path2);
118 $path1 = $instances[
'scorm']->getImagePathFailed();
120 $this->assertSame($path1, $path2);
129 $this->expectException(ilLPException::class);
130 $instances[
'long']->getImagePathRunning();
139 $this->expectException(ilLPException::class);
140 $instances[
'long']->getImagePathAsset();
151 'rendered: path(' . $this->path .
152 '), alt(' . $this->alt .
153 '), size(' . $this->size .
')',
154 $instances[
'long']->renderIcon($this->path, $this->alt)
158 'rendered: path(' . $this->path .
159 '), alt(' . $this->alt .
160 '), size(' . $this->size .
')',
161 $instances[
'short']->renderIcon($this->path, $this->alt)
171 $this->expectException(ilLPException::class);
172 $instances[
'scorm']->renderIcon(
'path',
'alt');
const LP_STATUS_COMPLETED_NUM
testRenderScormIcons(array $instances)
testTripleton
testImagePathRunningForLongVariant(array $instances)
testTripleton
testImagePathAssetForLongVariant(array $instances)
testTripleton
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
Unit tests for class ilLPStatusIcons.
testGetInstanceForInvalidVariant()
testSomeExamplesForRenderedIcons(array $instances)
testTripleton
const LP_STATUS_FAILED_NUM