Definition at line 38 of file CopyrightHandlerTest.php.
◆ getCopyrightEntry()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::getCopyrightEntry |
( |
int |
$id, |
|
|
string |
$full_name, |
|
|
?string |
$link, |
|
|
bool |
$default = false |
|
) |
| |
|
protected |
Definition at line 47 of file CopyrightHandlerTest.php.
52 : EntryInterface {
53 $url = is_null($link) ? null : $this->
getURI($link);
54
55 return new class (
$id, $full_name,
$url, $default) extends NullEntry {
58 protected string $full_name,
60 protected bool $default
61 ) {
62 }
63
64 public function id():
int
65 {
67 }
68
69 public function isDefault(): bool
70 {
71 return $this->default;
72 }
73
74 public function copyrightData(): CopyrightDataInterface
75 {
76 return new class ($this->full_name,
$this->url) extends NullCopyrightData {
78 protected string $full_name,
80 ) {
81 }
82
83 public function fullName(): string
84 {
85 return $this->full_name;
86 }
87
88 public function link(): ?URI
89 {
91 }
92 };
93 }
94 };
95 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct()
Constructor setup ILIAS global object @access public.
link(string $caption, string $href, bool $new_viewport=false)
References $id, $url, ILIAS\__construct(), ILIAS\GlobalScreen\Provider\id(), and ILIAS\Repository\link().
◆ getCopyrightRepository()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::getCopyrightRepository |
( |
EntryInterface ... |
$entries | ) |
|
|
protected |
Definition at line 97 of file CopyrightHandlerTest.php.
97 : CopyrightRepository
98 {
99 return new class ($entries) extends NullRepository {
100 public function __construct(
protected array $entries)
101 {
102 }
103
104 public function getAllEntries(): \Generator
105 {
106 yield
from $this->entries;
107 }
108
109 public function getEntry(
int $id): EntryInterface
110 {
111 foreach ($this->entries as $entry) {
112 if ($entry->id() ===
$id) {
113 return $entry;
114 }
115 }
116 return new NullEntry();
117 }
118
119 public function getDefaultEntry(): EntryInterface
120 {
121 foreach ($this->entries as $entry) {
122 if ($entry->isDefault()) {
123 return $entry;
124 }
125 }
126 return new NullEntry();
127 }
128 };
129 }
References $id, ILIAS\__construct(), and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().
◆ getIdentifierHandler()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::getIdentifierHandler |
( |
| ) |
|
|
protected |
Definition at line 131 of file CopyrightHandlerTest.php.
131 : IdentifierHandler
132 {
133 return new class () extends NullHandler {
134 public function isIdentifierValid(string $identifier): bool
135 {
136 return str_contains($identifier, 'valid_identifier_');
137 }
138
139 public function parseEntryIDFromIdentifier(
string $identifier):
int
140 {
141 return (int) str_replace('valid_identifier_', '', $identifier);
142 }
143
144 public function buildIdentifierFromEntryID(int $entry_id): string
145 {
146 return 'valid_identifier_' . $entry_id;
147 }
148 };
149 }
◆ getSettings()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::getSettings |
( |
bool |
$selection_active | ) |
|
|
protected |
Definition at line 151 of file CopyrightHandlerTest.php.
151 : SettingsInterface
152 {
153 return new class ($selection_active) extends NullSettings {
154 public function __construct(
protected bool $selection_active)
155 {
156 }
157
158 public function isCopyrightSelectionActive(): bool
159 {
160 return $this->selection_active;
161 }
162 };
163 }
References ILIAS\__construct().
◆ getURI()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::getURI |
( |
string |
$link | ) |
|
|
protected |
◆ testCopyrightAsString()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightAsString |
( |
| ) |
|
Definition at line 187 of file CopyrightHandlerTest.php.
187 : void
188 {
189 $entries = [
192 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
193 ];
198 );
199
200 $this->assertSame(
201 'http://www.example2.com',
202 $handler->copyrightAsString(
'valid_identifier_55')
203 );
204 }
References $handler.
◆ testCopyrightAsStringEntryIdNotFound()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightAsStringEntryIdNotFound |
( |
| ) |
|
Definition at line 244 of file CopyrightHandlerTest.php.
244 : void
245 {
246 $entries = [
249 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
250 ];
255 );
256
257 $this->assertSame(
258 '',
259 $handler->copyrightAsString(
'valid_identifier_678')
260 );
261 }
References $handler.
◆ testCopyrightAsStringInactiveCPSelection()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightAsStringInactiveCPSelection |
( |
| ) |
|
Definition at line 206 of file CopyrightHandlerTest.php.
206 : void
207 {
208 $entries = [
211 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
212 ];
217 );
218
219 $this->assertSame(
220 'valid_identifier_55',
221 $handler->copyrightAsString(
'valid_identifier_55')
222 );
223 }
References $handler.
◆ testCopyrightAsStringInvalidAsIdentifier()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightAsStringInvalidAsIdentifier |
( |
| ) |
|
Definition at line 225 of file CopyrightHandlerTest.php.
225 : void
226 {
227 $entries = [
230 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
231 ];
236 );
237
238 $this->assertSame(
239 'something invalid',
240 $handler->copyrightAsString(
'something invalid')
241 );
242 }
References $handler.
◆ testCopyrightForExportEmpty()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportEmpty |
( |
| ) |
|
Definition at line 320 of file CopyrightHandlerTest.php.
320 : void
321 {
322 $entries = [
325 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
326 ];
331 );
332
333 $this->assertSame(
334 'http://www.example2.com',
336 );
337 }
References $handler.
◆ testCopyrightForExportEntryIdNotFound()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportEntryIdNotFound |
( |
| ) |
|
Definition at line 282 of file CopyrightHandlerTest.php.
282 : void
283 {
284 $entries = [
287 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
288 ];
293 );
294
295 $this->assertSame(
296 '',
297 $handler->copyrightForExport(
'valid_identifier_678')
298 );
299 }
References $handler.
◆ testCopyrightForExportHasFullName()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportHasFullName |
( |
| ) |
|
Definition at line 358 of file CopyrightHandlerTest.php.
358 : void
359 {
360 $entries = [
363 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
364 ];
369 );
370
371 $this->assertSame(
372 'second entry',
373 $handler->copyrightForExport(
'valid_identifier_55')
374 );
375 }
References $handler.
◆ testCopyrightForExportHasFullNameAndLink()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportHasFullNameAndLink |
( |
| ) |
|
Definition at line 377 of file CopyrightHandlerTest.php.
377 : void
378 {
379 $entries = [
382 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
383 ];
388 );
389
390 $this->assertSame(
391 'http://www.example2.com',
392 $handler->copyrightForExport(
'valid_identifier_55')
393 );
394 }
References $handler.
◆ testCopyrightForExportHasLink()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportHasLink |
( |
| ) |
|
Definition at line 339 of file CopyrightHandlerTest.php.
339 : void
340 {
341 $entries = [
344 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
345 ];
350 );
351
352 $this->assertSame(
353 'http://www.example2.com',
354 $handler->copyrightForExport(
'valid_identifier_55')
355 );
356 }
References $handler.
◆ testCopyrightForExportHasNoFullNameOrLink()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportHasNoFullNameOrLink |
( |
| ) |
|
Definition at line 396 of file CopyrightHandlerTest.php.
396 : void
397 {
398 $entries = [
401 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
402 ];
407 );
408
409 $this->assertSame(
410 '',
411 $handler->copyrightForExport(
'valid_identifier_55')
412 );
413 }
References $handler.
◆ testCopyrightForExportInactiveCPSelection()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportInactiveCPSelection |
( |
| ) |
|
Definition at line 301 of file CopyrightHandlerTest.php.
301 : void
302 {
303 $entries = [
306 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
307 ];
312 );
313
314 $this->assertSame(
315 'valid_identifier_55',
316 $handler->copyrightForExport(
'valid_identifier_55')
317 );
318 }
References $handler.
◆ testCopyrightForExportInvalidAsIdentifier()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightForExportInvalidAsIdentifier |
( |
| ) |
|
Definition at line 263 of file CopyrightHandlerTest.php.
263 : void
264 {
265 $entries = [
268 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
269 ];
274 );
275
276 $this->assertSame(
277 'something invalid',
278 $handler->copyrightForExport(
'something invalid')
279 );
280 }
References $handler.
◆ testCopyrightFromExportInactiveCPSelection()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportInactiveCPSelection |
( |
| ) |
|
Definition at line 476 of file CopyrightHandlerTest.php.
476 : void
477 {
478 $entries = [
481 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
482 ];
487 );
488
489 $this->assertSame(
490 'some text containing http://www.example2.com',
491 $handler->copyrightFromExport(
'some text containing http://www.example2.com')
492 );
493 }
References $handler.
◆ testCopyrightFromExportMatchesByFullName()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportMatchesByFullName |
( |
| ) |
|
Definition at line 495 of file CopyrightHandlerTest.php.
495 : void
496 {
497 $entries = [
500 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
501 ];
506 );
507
508 $this->assertSame(
509 'valid_identifier_13',
510 $handler->copyrightFromExport(
'first entry')
511 );
512 $this->assertSame(
513 'valid_identifier_55',
514 $handler->copyrightFromExport(
'second entry')
515 );
516 }
References $handler.
◆ testCopyrightFromExportMatchesByLink()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportMatchesByLink |
( |
| ) |
|
Definition at line 537 of file CopyrightHandlerTest.php.
537 : void
538 {
539 $entries = [
542 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
543 ];
548 );
549
550 $this->assertSame(
551 'valid_identifier_55',
552 $handler->copyrightFromExport(
'some text containing http://www.example2.com')
553 );
554 }
References $handler.
◆ testCopyrightFromExportMatchesByLinkButDifferentScheme()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportMatchesByLinkButDifferentScheme |
( |
| ) |
|
Definition at line 575 of file CopyrightHandlerTest.php.
575 : void
576 {
577 $entries = [
580 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
581 ];
586 );
587
588 $this->assertSame(
589 'valid_identifier_55',
590 $handler->copyrightFromExport(
'some text containing https://www.example2.com')
591 );
592 }
References $handler.
◆ testCopyrightFromExportMultipleMatchesByFullName()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportMultipleMatchesByFullName |
( |
| ) |
|
Definition at line 518 of file CopyrightHandlerTest.php.
518 : void
519 {
520 $entries = [
523 $this->
getCopyrightEntry(123,
'second entry',
'https://www.example3.com/something')
524 ];
529 );
530
531 $this->assertSame(
532 'valid_identifier_55',
533 $handler->copyrightFromExport(
'second entry')
534 );
535 }
References $handler.
◆ testCopyrightFromExportMultipleMatchesByLink()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportMultipleMatchesByLink |
( |
| ) |
|
Definition at line 556 of file CopyrightHandlerTest.php.
556 : void
557 {
558 $entries = [
560 $this->
getCopyrightEntry(55,
'second entry',
'https://www.example3.com/something'),
561 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
562 ];
567 );
568
569 $this->assertSame(
570 'valid_identifier_55',
571 $handler->copyrightFromExport(
'some text containing https://www.example3.com/something')
572 );
573 }
References $handler.
◆ testCopyrightFromExportNoMatches()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportNoMatches |
( |
| ) |
|
Definition at line 415 of file CopyrightHandlerTest.php.
415 : void
416 {
417 $entries = [
420 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
421 ];
426 );
427
428 $this->assertSame(
429 'just some text',
430 $handler->copyrightFromExport(
'just some text')
431 );
432 }
References $handler.
◆ testCopyrightFromExportNoMatchesContainsFullName()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportNoMatchesContainsFullName |
( |
| ) |
|
Definition at line 457 of file CopyrightHandlerTest.php.
457 : void
458 {
459 $entries = [
462 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
463 ];
468 );
469
470 $this->assertSame(
471 'just some text which contains first entry',
472 $handler->copyrightFromExport(
'just some text which contains first entry')
473 );
474 }
References $handler.
◆ testCopyrightFromExportURLWithNoMatchesShouldBeUnchanged()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testCopyrightFromExportURLWithNoMatchesShouldBeUnchanged |
( |
| ) |
|
Definition at line 434 of file CopyrightHandlerTest.php.
434 : void
435 {
436 $entries = [
439 $this->
getCopyrightEntry(123,
'third entry',
'https://www.example3.com/something')
440 ];
445 );
446
447 $this->assertSame(
448 'https://www.nonmatching.com',
449 $handler->copyrightFromExport(
'https://www.nonmatching.com')
450 );
451 $this->assertSame(
452 'http://www.nonmatching.com',
453 $handler->copyrightFromExport(
'http://www.nonmatching.com')
454 );
455 }
References $handler.
◆ testIsCopyrightSelectionActiveFalse()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testIsCopyrightSelectionActiveFalse |
( |
| ) |
|
◆ testIsCopyrightSelectionActiveTrue()
ILIAS\MetaData\XML\Copyright\CopyrightHandlerTest::testIsCopyrightSelectionActiveTrue |
( |
| ) |
|
The documentation for this class was generated from the following file: