ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest:
+ Collaboration diagram for ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest:

Public Member Functions

 testIsCopyrightSelectionActiveTrue ()
 
 testIsCopyrightSelectionActiveFalse ()
 
 testHasPresetCopyrightTrue ()
 
 testHasPresetCopyrightTrueEmpty ()
 
 testHasPresetCopyrightFalse ()
 
 testHasPresetCopyrightFalseInactiveCPSelection ()
 
 testReadPresetCopyright ()
 
 testReadPresetCopyrightInactiveCPSelection ()
 
 testReadPresetCopyrightInvalidIdentifier ()
 
 testReadPresetCopyrightEmptyRawCopyright ()
 
 testReadCustomCopyright ()
 
 testReadCustomCopyrightValidIdentifier ()
 
 testReadCustomCopyrightValidIdentifierButInactiveCPSelection ()
 
 testPrepareCreateOrUpdateOfCopyrightFromPreset ()
 
 testPrepareCreateOrUpdateOfCustomCopyright ()
 
 testGetAllCopyrightPresets ()
 
 testGetAllCopyrightPresetsInactiveCPSelection ()
 
 testGetNonOutdatedCopyrightPresets ()
 
 testGetNonOutdatedCopyrightPresetsInactiveCPSelection ()
 
 testGetCopyrightSearchClause ()
 
 testGetCopyrightSearchClauseMultipleCPIdentifiers ()
 
 testGetCopyrightSearchClauseDefaultCPIdentifier ()
 
 testGetCopyrightSearchClauseDefaultCPIdentifierButInactiveCPSelection ()
 

Protected Member Functions

 getSettings (bool $selection_active)
 
 getPathFactory ()
 
 getCopyrightEntry (int $id)
 
 getCopyrightRepository (array $entry_ids, array $outdated_entry_ids, int $default_entry_id)
 
 getIdentifierHandler ()
 
 getClauseFactory ()
 
 getReader (string $raw_copyright)
 
 getManipulator ()
 
 getCopyrightHelper (SettingsInterface $settings, CopyrightRepository $copyright_repo)
 

Detailed Description

Definition at line 52 of file CopyrightHelperTest.php.

Member Function Documentation

◆ getClauseFactory()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getClauseFactory ( )
protected

Definition at line 191 of file CopyrightHelperTest.php.

191 : SearchClauseFactory
192 {
193 return new class () extends NullSearchClauseFactory {
194 public function getBasicClause(
195 PathInterface $path,
196 Mode $mode,
197 string $value,
198 bool $is_mode_negated = false
199 ): ClauseInterface {
200 $search_data = '"' . $path->toString() . '" ' .
201 ($is_mode_negated ? 'not ' : '') .
202 $mode->value . ' "' . $value . '"';
203 return new class ($search_data) extends NullClause {
204 public function __construct(public string $exposed_search_data)
205 {
206 }
207 };
208 }
209
210 public function getJoinedClauses(
211 Operator $operator,
212 ClauseInterface $first_clause,
213 ClauseInterface ...$further_clauses
214 ): ClauseInterface {
215 $clauses_data = [];
216 foreach ([$first_clause, ...$further_clauses] as $clause) {
217 $clauses_data[] = $clause->exposed_search_data;
218 }
219 $search_data = implode(' ' . $operator->value . ' ', $clauses_data);
220 return new class ($search_data) extends NullClause {
221 public function __construct(public string $exposed_search_data)
222 {
223 }
224 };
225 }
226 };
227 }
__construct(SettingsInterface $settings, PathFactory $path_factory, CopyrightRepository $copyright_repo, IdentifierHandler $identifier_handler, RendererInterface $renderer, SearchClauseFactory $search_clause_factory)
$path
Definition: ltiservices.php:30

References $path, and ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct().

+ Here is the call graph for this function:

◆ getCopyrightEntry()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getCopyrightEntry ( int  $id)
protected

Definition at line 101 of file CopyrightHelperTest.php.

101 : EntryInterface
102 {
103 return new class ($id) extends NullEntry {
104 public function __construct(protected int $id)
105 {
106 }
107
108 public function id(): int
109 {
110 return $this->id;
111 }
112 };
113 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct(), and ILIAS\GlobalScreen\Provider\id().

Referenced by ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest\getCopyrightRepository().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCopyrightHelper()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getCopyrightHelper ( SettingsInterface  $settings,
CopyrightRepository  $copyright_repo 
)
protected

Definition at line 272 of file CopyrightHelperTest.php.

275 : CopyrightHelper {
276 return new class (
277 $settings,
278 $this->getPathFactory(),
280 $this->getIdentifierHandler(),
281 new NullRenderer(),
282 $this->getClauseFactory()
283 ) extends CopyrightHelper {
284 protected function getCopyrightEntryWrapper(EntryInterface $entry): CopyrightInterface
285 {
286 return new class ((string) $entry->id()) extends NullCopyright {
287 public function __construct(public string $exposed_id)
288 {
289 }
290 };
291 }
292
293 protected function getNullCopyrightEntryWrapper(): CopyrightInterface
294 {
295 return new class ('null') extends NullCopyright {
296 public function __construct(public string $exposed_id)
297 {
298 }
299 };
300 }
301 };
302 }

References ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct().

+ Here is the call graph for this function:

◆ getCopyrightRepository()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getCopyrightRepository ( array  $entry_ids,
array  $outdated_entry_ids,
int  $default_entry_id 
)
protected
Parameters
int[]$entry_ids
int[]$outdated_entry_ids

Definition at line 119 of file CopyrightHelperTest.php.

123 : CopyrightRepository {
124 $entries = [];
125 foreach ($entry_ids as $id) {
126 $entries[] = $this->getCopyrightEntry($id);
127 }
128
129 return new class ($entries, $outdated_entry_ids, $default_entry_id) extends NullRepository {
130 public function __construct(
131 protected array $entries,
132 protected array $outdated_entry_ids,
133 protected int $default_entry_id
134 ) {
135 }
136
137 public function getAllEntries(): \Generator
138 {
139 yield from $this->entries;
140 }
141
142 public function getActiveEntries(): \Generator
143 {
144 foreach ($this->entries as $entry) {
145 if (!in_array($entry->id(), $this->outdated_entry_ids)) {
146 yield $entry;
147 }
148 }
149 }
150
151 public function getDefaultEntry(): EntryInterface
152 {
153 foreach ($this->entries as $entry) {
154 if ($entry->id() === $this->default_entry_id) {
155 return $entry;
156 }
157 }
158 throw new \ilMDServicesException('Default entry id not found.');
159 }
160
161 public function getEntry(int $id): EntryInterface
162 {
163 foreach ($this->entries as $entry) {
164 if ($entry->id() === $id) {
165 return $entry;
166 }
167 }
168 throw new \ilMDServicesException('Entry id not found.');
169 }
170 };
171 }

References ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest\getCopyrightEntry().

+ Here is the call graph for this function:

◆ getIdentifierHandler()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getIdentifierHandler ( )
protected

Definition at line 173 of file CopyrightHelperTest.php.

173 : IdentifierHandler
174 {
175 return new class () extends NullHandler {
176 public function isIdentifierValid(string $identifier): bool
177 {
178 return str_contains($identifier, 'valid_');
179 }
180
181 public function parseEntryIDFromIdentifier(string $identifier): int
182 {
183 if ($this->isIdentifierValid($identifier)) {
184 return (int) str_replace('valid_', '', $identifier);
185 }
186 return 0;
187 }
188 };
189 }

◆ getManipulator()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getManipulator ( )
protected

Definition at line 255 of file CopyrightHelperTest.php.

255 : ManipulatorInterface
256 {
257 return new class () extends NullManipulator {
258 public array $prepared_creates_or_updates = [];
259
260 public function prepareCreateOrUpdate(PathInterface $path, string ...$values): ManipulatorInterface
261 {
262 $clone = clone $this;
263 $clone->prepared_creates_or_updates[] = [
264 'path' => $path->toString(),
265 'values' => $values,
266 ];
267 return $clone;
268 }
269 };
270 }

References $path.

◆ getPathFactory()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getPathFactory ( )
protected

Definition at line 68 of file CopyrightHelperTest.php.

68 : PathFactory
69 {
70 return new class () extends NullPathFactory {
71 public function custom(): BuilderInterface
72 {
73 return new class () extends NullBuilder {
74 protected string $path = '';
75
76 public function withNextStep(string $name, bool $add_as_first = false): BuilderInterface
77 {
78 $clone = clone $this;
79 $clone->path .= '>' . $name;
80 return $clone;
81 }
82
83 public function get(): PathInterface
84 {
85 return new class ($this->path) extends NullPath {
86 public function __construct(protected string $path)
87 {
88 }
89
90 public function toString(): string
91 {
92 return $this->path;
93 }
94 };
95 }
96 };
97 }
98 };
99 }

References $path, ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct(), ILIAS\UI\examples\Chart\Bar\Horizontal\custom(), and ILIAS\Export\ImportHandler\File\XML\Manifest\toString.

+ Here is the call graph for this function:

◆ getReader()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getReader ( string  $raw_copyright)
protected

Definition at line 229 of file CopyrightHelperTest.php.

229 : ReaderInterface
230 {
231 return new class ($raw_copyright) extends NullReader {
232 public function __construct(protected string $raw_copyright)
233 {
234 }
235
236 public function firstData(PathInterface $path): DataInterface
237 {
238 if ($path->toString() !== '>rights>description>string') {
239 throw new \ilMDServicesException('Wrong Path!');
240 }
241 return new class ($this->raw_copyright) extends NullData {
242 public function __construct(protected string $raw_copyright)
243 {
244 }
245
246 public function value(): string
247 {
248 return $this->raw_copyright;
249 }
250 };
251 }
252 };
253 }

References $path, and ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct().

+ Here is the call graph for this function:

◆ getSettings()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::getSettings ( bool  $selection_active)
protected

Definition at line 54 of file CopyrightHelperTest.php.

54 : SettingsInterface
55 {
56 return new class ($selection_active) extends NullSettings {
57 public function __construct(protected bool $selection_active)
58 {
59 }
60
61 public function isCopyrightSelectionActive(): bool
62 {
63 return $this->selection_active;
64 }
65 };
66 }
isCopyrightSelectionActive()
If copyright selection is not active, there are no copyright presets to choose from,...

References ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct(), and ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\isCopyrightSelectionActive().

+ Here is the call graph for this function:

◆ testGetAllCopyrightPresets()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetAllCopyrightPresets ( )

Definition at line 492 of file CopyrightHelperTest.php.

492 : void
493 {
494 $helper = $this->getCopyrightHelper(
495 $this->getSettings(true),
496 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
497 );
498
499 $presets = $helper->getAllCopyrightPresets();
500
501 $this->assertSame('13', $presets->current()->exposed_id);
502 $presets->next();
503 $this->assertSame('77', $presets->current()->exposed_id);
504 $presets->next();
505 $this->assertSame('932', $presets->current()->exposed_id);
506 $presets->next();
507 $this->assertSame('5', $presets->current()->exposed_id);
508 $presets->next();
509 $this->assertNull($presets->current());
510 }
getCopyrightRepository(array $entry_ids, array $outdated_entry_ids, int $default_entry_id)
getCopyrightHelper(SettingsInterface $settings, CopyrightRepository $copyright_repo)

◆ testGetAllCopyrightPresetsInactiveCPSelection()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetAllCopyrightPresetsInactiveCPSelection ( )

Definition at line 512 of file CopyrightHelperTest.php.

512 : void
513 {
514 $helper = $this->getCopyrightHelper(
515 $this->getSettings(false),
516 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
517 );
518
519 $presets = $helper->getAllCopyrightPresets();
520
521 $this->assertNull($presets->current());
522 }

◆ testGetCopyrightSearchClause()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetCopyrightSearchClause ( )

Definition at line 554 of file CopyrightHelperTest.php.

554 : void
555 {
556 $helper = $this->getCopyrightHelper(
557 $this->getSettings(true),
558 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
559 );
560
561 $clause = $helper->getCopyrightSearchClause('valid_5');
562
563 $this->assertSame(
564 '">rights>description>string" equals "valid_5"',
565 $clause->exposed_search_data
566 );
567 }

◆ testGetCopyrightSearchClauseDefaultCPIdentifier()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetCopyrightSearchClauseDefaultCPIdentifier ( )

Definition at line 590 of file CopyrightHelperTest.php.

590 : void
591 {
592 $helper = $this->getCopyrightHelper(
593 $this->getSettings(true),
594 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
595 );
596
597 $clause = $helper->getCopyrightSearchClause('valid_13');
598
599 $this->assertSame(
600 '">rights>description>string" equals "valid_13" or ' .
601 '">rights>description>string" equals ""',
602 $clause->exposed_search_data
603 );
604 }

◆ testGetCopyrightSearchClauseDefaultCPIdentifierButInactiveCPSelection()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetCopyrightSearchClauseDefaultCPIdentifierButInactiveCPSelection ( )

Definition at line 606 of file CopyrightHelperTest.php.

606 : void
607 {
608 $helper = $this->getCopyrightHelper(
609 $this->getSettings(false),
610 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
611 );
612
613 $clause = $helper->getCopyrightSearchClause('valid_13');
614
615 $this->assertSame(
616 '">rights>description>string" equals "valid_13"',
617 $clause->exposed_search_data
618 );
619 }

◆ testGetCopyrightSearchClauseMultipleCPIdentifiers()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetCopyrightSearchClauseMultipleCPIdentifiers ( )

Definition at line 569 of file CopyrightHelperTest.php.

569 : void
570 {
571 $helper = $this->getCopyrightHelper(
572 $this->getSettings(true),
573 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
574 );
575
576 $clause = $helper->getCopyrightSearchClause(
577 'valid_5',
578 'valid_77',
579 'something else'
580 );
581
582 $this->assertSame(
583 '">rights>description>string" equals "valid_5" or ' .
584 '">rights>description>string" equals "valid_77" or ' .
585 '">rights>description>string" equals "something else"',
586 $clause->exposed_search_data
587 );
588 }

◆ testGetNonOutdatedCopyrightPresets()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetNonOutdatedCopyrightPresets ( )

Definition at line 524 of file CopyrightHelperTest.php.

524 : void
525 {
526 $helper = $this->getCopyrightHelper(
527 $this->getSettings(true),
528 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
529 );
530
531 $presets = $helper->getNonOutdatedCopyrightPresets();
532
533 $this->assertSame('13', $presets->current()->exposed_id);
534 $presets->next();
535 $this->assertSame('932', $presets->current()->exposed_id);
536 $presets->next();
537 $this->assertSame('5', $presets->current()->exposed_id);
538 $presets->next();
539 $this->assertNull($presets->current());
540 }

◆ testGetNonOutdatedCopyrightPresetsInactiveCPSelection()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testGetNonOutdatedCopyrightPresetsInactiveCPSelection ( )

Definition at line 542 of file CopyrightHelperTest.php.

542 : void
543 {
544 $helper = $this->getCopyrightHelper(
545 $this->getSettings(false),
546 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
547 );
548
549 $presets = $helper->getNonOutdatedCopyrightPresets();
550
551 $this->assertNull($presets->current());
552 }

◆ testHasPresetCopyrightFalse()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testHasPresetCopyrightFalse ( )

Definition at line 346 of file CopyrightHelperTest.php.

346 : void
347 {
348 $helper = $this->getCopyrightHelper(
349 $this->getSettings(true),
350 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
351 );
352 $reader = $this->getReader('something else');
353
354 $this->assertFalse($helper->hasPresetCopyright($reader));
355 }

◆ testHasPresetCopyrightFalseInactiveCPSelection()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testHasPresetCopyrightFalseInactiveCPSelection ( )

Definition at line 357 of file CopyrightHelperTest.php.

357 : void
358 {
359 $helper = $this->getCopyrightHelper(
360 $this->getSettings(false),
361 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
362 );
363 $reader = $this->getReader('valid_5');
364
365 $this->assertFalse($helper->hasPresetCopyright($reader));
366 }

◆ testHasPresetCopyrightTrue()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testHasPresetCopyrightTrue ( )

Definition at line 324 of file CopyrightHelperTest.php.

324 : void
325 {
326 $helper = $this->getCopyrightHelper(
327 $this->getSettings(true),
328 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
329 );
330 $reader = $this->getReader('valid_5');
331
332 $this->assertTrue($helper->hasPresetCopyright($reader));
333 }

◆ testHasPresetCopyrightTrueEmpty()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testHasPresetCopyrightTrueEmpty ( )

Definition at line 335 of file CopyrightHelperTest.php.

335 : void
336 {
337 $helper = $this->getCopyrightHelper(
338 $this->getSettings(true),
339 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
340 );
341 $reader = $this->getReader('');
342
343 $this->assertTrue($helper->hasPresetCopyright($reader));
344 }

◆ testIsCopyrightSelectionActiveFalse()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testIsCopyrightSelectionActiveFalse ( )

Definition at line 314 of file CopyrightHelperTest.php.

314 : void
315 {
316 $helper = $this->getCopyrightHelper(
317 $this->getSettings(false),
318 $this->getCopyrightRepository([], [], 0)
319 );
320
321 $this->assertFalse($helper->isCopyrightSelectionActive());
322 }

◆ testIsCopyrightSelectionActiveTrue()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testIsCopyrightSelectionActiveTrue ( )

Definition at line 304 of file CopyrightHelperTest.php.

304 : void
305 {
306 $helper = $this->getCopyrightHelper(
307 $this->getSettings(true),
308 $this->getCopyrightRepository([], [], 0)
309 );
310
311 $this->assertTrue($helper->isCopyrightSelectionActive());
312 }

◆ testPrepareCreateOrUpdateOfCopyrightFromPreset()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testPrepareCreateOrUpdateOfCopyrightFromPreset ( )

Definition at line 454 of file CopyrightHelperTest.php.

454 : void
455 {
456 $helper = $this->getCopyrightHelper(
457 $this->getSettings(false),
458 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
459 );
460 $manipulator = $this->getManipulator();
461
462 $manipulator = $helper->prepareCreateOrUpdateOfCopyrightFromPreset(
463 $manipulator,
464 'valid_5'
465 );
466
467 $this->assertSame(
468 [['path' => '>rights>description>string', 'values' => ['valid_5']]],
469 $manipulator->prepared_creates_or_updates
470 );
471 }

◆ testPrepareCreateOrUpdateOfCustomCopyright()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testPrepareCreateOrUpdateOfCustomCopyright ( )

Definition at line 473 of file CopyrightHelperTest.php.

473 : void
474 {
475 $helper = $this->getCopyrightHelper(
476 $this->getSettings(false),
477 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
478 );
479 $manipulator = $this->getManipulator();
480
481 $manipulator = $helper->prepareCreateOrUpdateOfCustomCopyright(
482 $manipulator,
483 'custom info about the copyright'
484 );
485
486 $this->assertSame(
487 [['path' => '>rights>description>string', 'values' => ['custom info about the copyright']]],
488 $manipulator->prepared_creates_or_updates
489 );
490 }

◆ testReadCustomCopyright()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadCustomCopyright ( )

Definition at line 412 of file CopyrightHelperTest.php.

412 : void
413 {
414 $helper = $this->getCopyrightHelper(
415 $this->getSettings(true),
416 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
417 );
418 $reader = $this->getReader('custom info about the copyright');
419
420 $this->assertSame(
421 'custom info about the copyright',
422 $helper->readCustomCopyright($reader)
423 );
424 }

◆ testReadCustomCopyrightValidIdentifier()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadCustomCopyrightValidIdentifier ( )

Definition at line 426 of file CopyrightHelperTest.php.

426 : void
427 {
428 $helper = $this->getCopyrightHelper(
429 $this->getSettings(true),
430 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
431 );
432 $reader = $this->getReader('valid_5');
433
434 $this->assertSame(
435 '',
436 $helper->readCustomCopyright($reader)
437 );
438 }

◆ testReadCustomCopyrightValidIdentifierButInactiveCPSelection()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadCustomCopyrightValidIdentifierButInactiveCPSelection ( )

Definition at line 440 of file CopyrightHelperTest.php.

440 : void
441 {
442 $helper = $this->getCopyrightHelper(
443 $this->getSettings(false),
444 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
445 );
446 $reader = $this->getReader('valid_5');
447
448 $this->assertSame(
449 '',
450 $helper->readCustomCopyright($reader)
451 );
452 }

◆ testReadPresetCopyright()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadPresetCopyright ( )

Definition at line 368 of file CopyrightHelperTest.php.

368 : void
369 {
370 $helper = $this->getCopyrightHelper(
371 $this->getSettings(true),
372 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
373 );
374 $reader = $this->getReader('valid_5');
375
376 $this->assertSame('5', $helper->readPresetCopyright($reader)->exposed_id);
377 }

◆ testReadPresetCopyrightEmptyRawCopyright()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadPresetCopyrightEmptyRawCopyright ( )

Definition at line 401 of file CopyrightHelperTest.php.

401 : void
402 {
403 $helper = $this->getCopyrightHelper(
404 $this->getSettings(true),
405 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
406 );
407 $reader = $this->getReader('');
408
409 $this->assertSame('13', $helper->readPresetCopyright($reader)->exposed_id);
410 }

◆ testReadPresetCopyrightInactiveCPSelection()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadPresetCopyrightInactiveCPSelection ( )

Definition at line 379 of file CopyrightHelperTest.php.

379 : void
380 {
381 $helper = $this->getCopyrightHelper(
382 $this->getSettings(false),
383 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
384 );
385 $reader = $this->getReader('valid_5');
386
387 $this->assertSame('null', $helper->readPresetCopyright($reader)->exposed_id);
388 }

◆ testReadPresetCopyrightInvalidIdentifier()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelperTest::testReadPresetCopyrightInvalidIdentifier ( )

Definition at line 390 of file CopyrightHelperTest.php.

390 : void
391 {
392 $helper = $this->getCopyrightHelper(
393 $this->getSettings(true),
394 $this->getCopyrightRepository([13, 77, 932, 5], [77], 13)
395 );
396 $reader = $this->getReader('something else');
397
398 $this->assertSame('null', $helper->readPresetCopyright($reader)->exposed_id);
399 }

The documentation for this class was generated from the following file: