19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
32use PHPUnit\Framework\MockObject\MockObject;
45 return $this->getMockBuilder(IIcon::class)
46 ->disableOriginalConstructor()
52 return $this->getMockBuilder(ILink::class)
53 ->disableOriginalConstructor()
62 public ?string $exposed_copyright_data = null;
65 protected ?
Icon $icon,
72 $this->exposed_copyright_data = $copyright->exposed_data;
74 if ($this->icon !==
null) {
77 if ($this->
link !==
null) {
83 public function toImageOnly(CopyrightDataInterface $copyright): ?Icon
85 $this->exposed_copyright_data = $copyright->exposed_data;
89 public function toLinkOnly(CopyrightDataInterface $copyright): ?Link
91 $this->exposed_copyright_data = $copyright->exposed_data;
95 public function toString(CopyrightDataInterface $copyright): string
97 return $copyright->exposed_data;
105 public function buildIdentifierFromEntryID(
int $entry_id):
string
107 return 'identifier_' . $entry_id;
120 return new class ($is_default, $is_outdated,
$id, $title, $description, $cp_data) extends
NullEntry {
122 protected bool $is_default,
123 protected bool $is_outdated,
125 protected string $title,
126 protected string $description,
127 protected string $cp_data
131 public function id():
int
136 public function title(): string
141 public function description(): string
143 return $this->description;
146 public function isDefault(): bool
148 return $this->is_default;
151 public function isOutdated(): bool
153 return $this->is_outdated;
156 public function copyrightData(): CopyrightDataInterface
158 return new class ($this->cp_data) extends NullCopyrightData {
159 public function __construct(
public string $exposed_data)
170 $this->getRenderer(),
171 $this->getIdentifierHandler(),
182 $this->assertTrue($copyright->isDefault());
188 $this->getRenderer(),
189 $this->getIdentifierHandler(),
200 $this->assertFalse($copyright->isDefault());
206 $this->getRenderer(),
207 $this->getIdentifierHandler(),
218 $this->assertTrue($copyright->isOutdated());
224 $this->getRenderer(),
225 $this->getIdentifierHandler(),
236 $this->assertFalse($copyright->isOutdated());
242 $this->getRenderer(),
243 $this->getIdentifierHandler(),
254 $this->assertSame(
'identifier_35', $copyright->identifier());
260 $this->getRenderer(),
261 $this->getIdentifierHandler(),
272 $this->assertSame(
'cp title', $copyright->title());
278 $this->getRenderer(),
279 $this->getIdentifierHandler(),
290 $this->assertSame(
'cp description', $copyright->description());
295 $icon = $this->getIcon();
296 $link = $this->getLink();
297 $renderer = $this->getRenderer($icon, $link);
300 $this->getIdentifierHandler(),
316 $this->assertSame(
'data of copyright',
$renderer->exposed_copyright_data);
321 $icon = $this->getIcon();
325 $this->getIdentifierHandler(),
336 $image = $copyright->presentAsImageOnly();
338 $this->assertSame($icon, $image);
339 $this->assertSame(
'data of copyright',
$renderer->exposed_copyright_data);
344 $link = $this->getLink();
345 $renderer = $this->getRenderer(
null, $link);
348 $this->getIdentifierHandler(),
359 $res_link = $copyright->presentAsLinkOnly();
361 $this->assertSame($link, $res_link);
362 $this->assertSame(
'data of copyright',
$renderer->exposed_copyright_data);
368 $this->getRenderer(),
369 $this->getIdentifierHandler(),
380 $this->assertSame(
'data of copyright', $copyright->presentAsString());
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This implements commonalities between Links.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes how an icon could be modified during construction of UI.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
link(string $caption, string $href, bool $new_viewport=false)