19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
42 $url = $this->createMock(URI::class);
43 $url->method(
'__toString')->willReturn($link);
53 $url = is_null($link) ? null : $this->
getURI($link);
58 protected string $full_name,
60 protected bool $default
64 public function id():
int
69 public function isDefault():
bool
71 return $this->default;
78 protected string $full_name,
83 public function fullName():
string
85 return $this->full_name;
100 public function __construct(
protected array $entries)
104 public function getAllEntries(): \Generator
106 yield
from $this->entries;
111 foreach ($this->entries as $entry) {
112 if ($entry->id() ===
$id) {
121 foreach ($this->entries as $entry) {
122 if ($entry->isDefault()) {
134 public function isIdentifierValid(
string $identifier):
bool
136 return str_contains($identifier,
'valid_identifier_');
139 public function parseEntryIDFromIdentifier(
string $identifier):
int
141 return (
int) str_replace(
'valid_identifier_',
'', $identifier);
144 public function buildIdentifierFromEntryID(
int $entry_id):
string
146 return 'valid_identifier_' . $entry_id;
153 return new class ($selection_active) extends
NullSettings {
154 public function __construct(
protected bool $selection_active)
158 public function isCopyrightSelectionActive():
bool
160 return $this->selection_active;
168 $this->getCopyrightRepository(),
169 $this->getIdentifierHandler(),
170 $this->getSettings(
true)
173 $this->assertTrue(
$handler->isCopyrightSelectionActive());
179 $this->getCopyrightRepository(),
180 $this->getIdentifierHandler(),
181 $this->getSettings(
false)
184 $this->assertFalse(
$handler->isCopyrightSelectionActive());
190 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
191 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
192 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
195 $this->getCopyrightRepository(...$entries),
196 $this->getIdentifierHandler(),
197 $this->getSettings(
true)
201 'http://www.example2.com',
202 $handler->copyrightAsString(
'valid_identifier_55')
209 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
210 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
211 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
214 $this->getCopyrightRepository(...$entries),
215 $this->getIdentifierHandler(),
216 $this->getSettings(
false)
220 'valid_identifier_55',
221 $handler->copyrightAsString(
'valid_identifier_55')
228 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
229 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
230 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
233 $this->getCopyrightRepository(...$entries),
234 $this->getIdentifierHandler(),
235 $this->getSettings(
true)
240 $handler->copyrightAsString(
'something invalid')
247 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
248 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
249 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
252 $this->getCopyrightRepository(...$entries),
253 $this->getIdentifierHandler(),
254 $this->getSettings(
true)
259 $handler->copyrightAsString(
'valid_identifier_678')
266 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
267 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
268 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
271 $this->getCopyrightRepository(...$entries),
272 $this->getIdentifierHandler(),
273 $this->getSettings(
true)
278 $handler->copyrightForExport(
'something invalid')
285 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
286 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
287 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
290 $this->getCopyrightRepository(...$entries),
291 $this->getIdentifierHandler(),
292 $this->getSettings(
true)
297 $handler->copyrightForExport(
'valid_identifier_678')
304 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
305 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
306 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
309 $this->getCopyrightRepository(...$entries),
310 $this->getIdentifierHandler(),
311 $this->getSettings(
false)
315 'valid_identifier_55',
316 $handler->copyrightForExport(
'valid_identifier_55')
323 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
324 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com',
true),
325 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
328 $this->getCopyrightRepository(...$entries),
329 $this->getIdentifierHandler(),
330 $this->getSettings(
true)
334 'http://www.example2.com',
342 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
343 $this->getCopyrightEntry(55,
'',
'http://www.example2.com'),
344 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
347 $this->getCopyrightRepository(...$entries),
348 $this->getIdentifierHandler(),
349 $this->getSettings(
true)
353 'http://www.example2.com',
354 $handler->copyrightForExport(
'valid_identifier_55')
361 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
362 $this->getCopyrightEntry(55,
'second entry',
null),
363 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
366 $this->getCopyrightRepository(...$entries),
367 $this->getIdentifierHandler(),
368 $this->getSettings(
true)
373 $handler->copyrightForExport(
'valid_identifier_55')
380 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
381 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
382 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
385 $this->getCopyrightRepository(...$entries),
386 $this->getIdentifierHandler(),
387 $this->getSettings(
true)
391 'http://www.example2.com',
392 $handler->copyrightForExport(
'valid_identifier_55')
399 $this->getCopyrightEntry(13,
'first entry',
'https://www.example1.com'),
400 $this->getCopyrightEntry(55,
'',
null),
401 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
404 $this->getCopyrightRepository(...$entries),
405 $this->getIdentifierHandler(),
406 $this->getSettings(
true)
411 $handler->copyrightForExport(
'valid_identifier_55')
418 $this->getCopyrightEntry(13,
'first entry',
null),
419 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
420 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
423 $this->getCopyrightRepository(...$entries),
424 $this->getIdentifierHandler(),
425 $this->getSettings(
true)
430 $handler->copyrightFromExport(
'just some text')
437 $this->getCopyrightEntry(13,
'first entry',
null),
438 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
439 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
442 $this->getCopyrightRepository(...$entries),
443 $this->getIdentifierHandler(),
444 $this->getSettings(
true)
448 'https://www.nonmatching.com',
449 $handler->copyrightFromExport(
'https://www.nonmatching.com')
452 'http://www.nonmatching.com',
453 $handler->copyrightFromExport(
'http://www.nonmatching.com')
460 $this->getCopyrightEntry(13,
'first entry',
null),
461 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
462 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
465 $this->getCopyrightRepository(...$entries),
466 $this->getIdentifierHandler(),
467 $this->getSettings(
true)
471 'just some text which contains first entry',
472 $handler->copyrightFromExport(
'just some text which contains first entry')
479 $this->getCopyrightEntry(13,
'first entry',
null),
480 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
481 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
484 $this->getCopyrightRepository(...$entries),
485 $this->getIdentifierHandler(),
486 $this->getSettings(
false)
490 'some text containing http://www.example2.com',
491 $handler->copyrightFromExport(
'some text containing http://www.example2.com')
498 $this->getCopyrightEntry(13,
'first entry',
null),
499 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
500 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
503 $this->getCopyrightRepository(...$entries),
504 $this->getIdentifierHandler(),
505 $this->getSettings(
true)
509 'valid_identifier_13',
510 $handler->copyrightFromExport(
'first entry')
513 'valid_identifier_55',
514 $handler->copyrightFromExport(
'second entry')
521 $this->getCopyrightEntry(13,
'first entry',
null),
522 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
523 $this->getCopyrightEntry(123,
'second entry',
'https://www.example3.com/something')
526 $this->getCopyrightRepository(...$entries),
527 $this->getIdentifierHandler(),
528 $this->getSettings(
true)
532 'valid_identifier_55',
533 $handler->copyrightFromExport(
'second entry')
540 $this->getCopyrightEntry(13,
'first entry',
null),
541 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
542 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
545 $this->getCopyrightRepository(...$entries),
546 $this->getIdentifierHandler(),
547 $this->getSettings(
true)
551 'valid_identifier_55',
552 $handler->copyrightFromExport(
'some text containing http://www.example2.com')
559 $this->getCopyrightEntry(13,
'first entry',
null),
560 $this->getCopyrightEntry(55,
'second entry',
'https://www.example3.com/something'),
561 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
564 $this->getCopyrightRepository(...$entries),
565 $this->getIdentifierHandler(),
566 $this->getSettings(
true)
570 'valid_identifier_55',
571 $handler->copyrightFromExport(
'some text containing https://www.example3.com/something')
578 $this->getCopyrightEntry(13,
'first entry',
null),
579 $this->getCopyrightEntry(55,
'second entry',
'http://www.example2.com'),
580 $this->getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
583 $this->getCopyrightRepository(...$entries),
584 $this->getIdentifierHandler(),
585 $this->getSettings(
true)
589 'valid_identifier_55',
590 $handler->copyrightFromExport(
'some text containing https://www.example2.com')
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
The scope of this class is split ilias-conform URI's into components.
__construct()
Constructor setup ILIAS global object @access public.
link(string $caption, string $href, bool $new_viewport=false)