19 declare(strict_types=1);
    36         'title' => 
'entry default',
    37         'description' => 
'description default',
    41         'full_name' => 
'full name default',
    42         'link' => 
'link default',
    43         'image_link' => 
'image link default',
    45         'alt_text' => 
'alt text default'    51         'description' => 
'description 1',
    55         'full_name' => 
'full name 1',
    57         'image_link' => 
'image link 1',
    59         'alt_text' => 
'alt text 1'    69         'full_name' => 
'full name 2',
    72         'image_file' => 
'image file 2',
    73         'alt_text' => 
'alt text 2'    78         return new class (self::NEXT_ID, $query_results) extends 
NullWrapper {
    79             public array $exposed_tables;
    80             public array $exposed_queries;
    81             public array $exposed_manipulates;
    82             public array $exposed_values;
    83             public array $exposed_wheres;
    86                 protected int $next_id,
    87                 protected array $query_results
    91             public function nextID(
string $table): 
int    93                 $this->exposed_tables[] = $table;
    94                 return $this->next_id;
    97             public function quoteInteger(
int $integer): 
string    99                 return '~' . $integer . 
'~';
   102             public function query(
string $query): \Generator
   104                 $this->exposed_queries[] = $query;
   105                 yield 
from $this->query_results;
   108             public function manipulate(
string $query): 
void   110                 $this->exposed_manipulates[] = $query;
   113             public function update(
string $table, array $values, array $where): 
void   115                 $this->exposed_tables[] = $table;
   116                 $this->exposed_values[] = $values;
   117                 $this->exposed_wheres[] = $where;
   120             public function insert(
string $table, array $values): 
void   122                 $this->exposed_tables[] = $table;
   123                 $this->exposed_values[] = $values;
   130         return $this->createMock(URI::class);
   140                 protected URI|MockObject $uri
   145             protected function getURI(
string $uri): 
URI   147                 $clone = clone $this->uri;
   148                 $clone->method(
'__toString')->willReturn($uri);
   159         $entry = $repo->getEntry(5);
   161             [
'SELECT * ' . 
'FROM il_md_cpr_selections WHERE entry_id = ~5~'],
   164         $this->assertSame(self::ROW_1[
'entry_id'], $entry->id());
   165         $this->assertSame(self::ROW_1[
'title'], $entry->title());
   166         $this->assertSame(self::ROW_1[
'description'], $entry->description());
   167         $this->assertSame((
bool) self::ROW_1[
'is_default'], $entry->isDefault());
   168         $this->assertSame((
bool) self::ROW_1[
'outdated'], $entry->isOutdated());
   169         $this->assertSame(self::ROW_1[
'position'], $entry->position());
   170         $this->assertSame(self::ROW_1[
'full_name'], $entry->copyrightData()->fullName());
   171         $this->assertSame(self::ROW_1[
'link'], (
string) $entry->copyrightData()->link());
   172         $this->assertSame(self::ROW_1[
'image_link'], (
string) $entry->copyrightData()->imageLink());
   173         $this->assertSame(self::ROW_1[
'image_file'], $entry->copyrightData()->imageFile());
   174         $this->assertSame(self::ROW_1[
'alt_text'], $entry->copyrightData()->altText());
   175         $this->assertSame((
bool) self::ROW_1[
'is_default'], $entry->copyrightData()->fallBackToDefaultImage());
   183         $entry = $repo->getEntry(67);
   185             [
'SELECT * ' . 
'FROM il_md_cpr_selections WHERE entry_id = ~67~'],
   188         $this->assertNull($entry->copyrightData()->link());
   189         $this->assertNull($entry->copyrightData()->imageLink());
   197         $this->assertEquals(
new NullEntry(), $repo->getEntry(5));
   199             [
'SELECT * ' . 
'FROM il_md_cpr_selections WHERE entry_id = ~5~'],
   209         $this->assertInstanceOf(EntryInterface::class, $repo->getDefaultEntry());
   211             [
'SELECT * FROM il_md_cpr_selections WHERE is_default = 1'],
   225         $res = iterator_to_array($repo->getAllEntries());
   227             [
'SELECT * FROM il_md_cpr_selections   228             ORDER BY is_default DESC, position ASC'],
   231         $this->assertCount(3, 
$res);
   232         $this->assertInstanceOf(EntryInterface::class, 
$res[0]);
   233         $this->assertInstanceOf(EntryInterface::class, 
$res[1]);
   234         $this->assertInstanceOf(EntryInterface::class, 
$res[2]);
   245         $res = iterator_to_array($repo->getActiveEntries());
   247             [
'SELECT * FROM il_md_cpr_selections WHERE outdated = 0   248             ORDER BY is_default DESC, position ASC'],
   251         $this->assertCount(2, 
$res);
   252         $this->assertInstanceOf(EntryInterface::class, 
$res[0]);
   253         $this->assertInstanceOf(EntryInterface::class, 
$res[1]);
   261         $repo->deleteEntry(5);
   263             [
'DELETE ' . 
'FROM il_md_cpr_selections WHERE entry_id = ~5~'],
   264             $db->exposed_manipulates
   272         $uri->method(
'__toString')->willReturn(
'new link');
   274         $img_uri->method(
'__toString')->willReturn(
'new image link');
   287             [
'SELECT MAX(position) AS max FROM il_md_cpr_selections WHERE is_default = 0'],
   292                 'il_md_cpr_selections',
   293                 'il_md_cpr_selections'   320         $uri->method(
'__toString')->willReturn(
'new link');
   333             [
'SELECT MAX(position) AS max FROM il_md_cpr_selections WHERE is_default = 0'],
   338                 'il_md_cpr_selections',
   339                 'il_md_cpr_selections'   366         $this->expectException(\ilMDCopyrightException::class);
   367         $repo->createEntry(
'');
   374         $uri->method(
'__toString')->willReturn(
'new link');
   376         $img_uri->method(
'__toString')->willReturn(
'new image link');
   390             [
'il_md_cpr_selections'],
   416         $uri->method(
'__toString')->willReturn(
'new link');
   418         $img_uri->method(
'__toString')->willReturn(
'new image link');
   432             [
'il_md_cpr_selections'],
   458         $this->expectException(\ilMDCopyrightException::class);
   459         $repo->updateEntry(21, 
'');
   467         $repo->reorderEntries(7, 5, 99, 1);
   469             [
'SELECT entry_id FROM il_md_cpr_selections WHERE is_default = 1'],
   474                 'il_md_cpr_selections',
   475                 'il_md_cpr_selections',
   476                 'il_md_cpr_selections' 
if($request_wrapper->has('ui_mainbar')) getURI()
 
__construct()
Constructor setup ILIAS global object  public. 
 
The scope of this class is split ilias-conform URI's into components. 
 
__construct(Container $dic, ilPlugin $plugin)