1 <?php declare(strict_types=1);
32 protected $path =
'sample/path';
41 $utilMock = Mockery::mock(
'alias:' . ilUtil::class);
42 $utilMock->shouldReceive(
'getImagePath')
43 ->with(Mockery::type(
'string'))
44 ->andReturnUsing(
function ($arg) {
45 return 'test/' . $arg;
48 $renderer = Mockery::mock(Renderer::class);
49 $renderer->shouldReceive(
'render')
50 ->andReturnUsing(
function ($arg1) {
51 return 'rendered: path(' . $arg1->getIconPath() .
52 '), alt(' . $arg1->getLabel() .
53 '), size(' . $arg1->getSize() .
')';
56 $custom_icon = Mockery::mock(Custom::class);
57 $custom_icon->shouldReceive(
'getIconPath')
58 ->andReturn($this->path);
59 $custom_icon->shouldReceive(
'getSize')
60 ->andReturn($this->size);
61 $custom_icon->shouldReceive(
'getLabel')
62 ->andReturn($this->alt);
64 $factory = Mockery::mock(Factory::class);
65 $factory->shouldReceive(
'symbol->icon->custom')
66 ->andReturn($custom_icon);
77 $this->assertSame($short1, $short2);
78 $this->assertSame($long1, $long2);
79 $this->assertSame($scorm1, $scorm2);
81 $this->assertNotSame($long1, $short1);
82 $this->assertNotSame($long1, $scorm1);
83 $this->assertNotSame($short1, $scorm1);
85 return [
'long' => $long1,
'short' => $short1,
'scorm' => $scorm1];
90 $renderer = $this->getMockBuilder(Renderer::class)
91 ->disableOriginalConstructor()
94 $factory = $this->getMockBuilder(Factory::class)
95 ->disableOriginalConstructor()
98 $this->expectException(ilLPException::class);
108 $path1 = $instances[
'long']->getImagePathInProgress();
110 $this->assertSame($path1, $path2);
112 $path1 = $instances[
'short']->getImagePathCompleted();
114 $this->assertSame($path1, $path2);
116 $path1 = $instances[
'scorm']->getImagePathFailed();
118 $this->assertSame($path1, $path2);
127 $this->expectException(ilLPException::class);
128 $instances[
'long']->getImagePathRunning();
137 $this->expectException(ilLPException::class);
138 $instances[
'long']->getImagePathAsset();
149 'rendered: path(' . $this->path .
150 '), alt(' . $this->alt .
151 '), size(' . $this->size .
')',
152 $instances[
'long']->renderIcon($this->path, $this->alt)
156 'rendered: path(' . $this->path .
157 '), alt(' . $this->alt .
158 '), size(' . $this->size .
')',
159 $instances[
'short']->renderIcon($this->path, $this->alt)
169 $this->expectException(ilLPException::class);
170 $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