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

Public Member Functions

 testIsDefaultTrue ()
 
 testIsDefaultFalse ()
 
 testIsOutdatedTrue ()
 
 testIsOutdatedFalse ()
 
 testIdentifier ()
 
 testTitle ()
 
 testDescription ()
 
 testPresentAsUIComponents ()
 
 testPresentAsString ()
 

Protected Member Functions

 getLegacyComponent ()
 
 getRenderer ()
 
 getIdentifierHandler ()
 
 getEntry (bool $is_default, bool $is_outdated, int $id, string $title, string $description, string $cp_data)
 

Detailed Description

Definition at line 38 of file CopyrightTest.php.

Member Function Documentation

◆ getEntry()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::getEntry ( bool  $is_default,
bool  $is_outdated,
int  $id,
string  $title,
string  $description,
string  $cp_data 
)
protected

Definition at line 82 of file CopyrightTest.php.

89 : EntryInterface {
90 return new class ($is_default, $is_outdated, $id, $title, $description, $cp_data) extends NullEntry {
91 public function __construct(
92 protected bool $is_default,
93 protected bool $is_outdated,
94 protected int $id,
95 protected string $title,
96 protected string $description,
97 protected string $cp_data
98 ) {
99 }
100
101 public function id(): int
102 {
103 return $this->id;
104 }
105
106 public function title(): string
107 {
108 return $this->title;
109 }
110
111 public function description(): string
112 {
113 return $this->description;
114 }
115
116 public function isDefault(): bool
117 {
118 return $this->is_default;
119 }
120
121 public function isOutdated(): bool
122 {
123 return $this->is_outdated;
124 }
125
126 public function copyrightData(): CopyrightDataInterface
127 {
128 return new class ($this->cp_data) extends NullCopyrightData {
129 public function __construct(public string $exposed_data)
130 {
131 }
132 };
133 }
134 };
135 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(SettingsInterface $settings, PathFactory $path_factory, CopyrightRepository $copyright_repo, IdentifierHandler $identifier_handler, RendererInterface $renderer, SearchClauseFactory $search_clause_factory)

◆ getIdentifierHandler()

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

Definition at line 72 of file CopyrightTest.php.

72 : IdentifierHandler
73 {
74 return new class () extends NullHandler {
75 public function buildIdentifierFromEntryID(int $entry_id): string
76 {
77 return 'identifier_' . $entry_id;
78 }
79 };
80 }

◆ getLegacyComponent()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::getLegacyComponent ( )
protected

Definition at line 40 of file CopyrightTest.php.

40 : MockObject|Content
41 {
42 return $this->getMockBuilder(ILegacy::class)
43 ->disableOriginalConstructor()
44 ->getMock();
45 }

Referenced by ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest\getRenderer().

+ Here is the caller graph for this function:

◆ getRenderer()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::getRenderer ( )
protected

Definition at line 47 of file CopyrightTest.php.

47 : RendererInterface
48 {
49 $legacy_component = $this->getLegacyComponent();
50 return new class ($legacy_component, $this->any()) extends NullRenderer {
51 public ?string $exposed_copyright_data = null;
52
53 public function __construct(
54 protected MockObject|Content $legacy,
55 protected AnyInvokedCount $any
56 ) {
57 }
58
59 public function toUIComponents(CopyrightDataInterface $copyright): array
60 {
61 $this->exposed_copyright_data = $copyright->exposed_data;
62 return [$this->legacy];
63 }
64
65 public function toString(CopyrightDataInterface $copyright): string
66 {
67 return $copyright->exposed_data;
68 }
69 };
70 }

References ILIAS\MetaData\Services\CopyrightHelper\CopyrightHelper\__construct(), ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest\getLegacyComponent(), and ILIAS\Export\ImportHandler\File\XML\Manifest\toString.

+ Here is the call graph for this function:

◆ testDescription()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testDescription ( )

Definition at line 245 of file CopyrightTest.php.

245 : void
246 {
247 $copyright = new Copyright(
248 $this->getRenderer(),
249 $this->getIdentifierHandler(),
250 $this->getEntry(
251 false,
252 false,
253 35,
254 'cp title',
255 'cp description',
256 'data of copyright'
257 )
258 );
259
260 $this->assertSame('cp description', $copyright->description());
261 }
getEntry(bool $is_default, bool $is_outdated, int $id, string $title, string $description, string $cp_data)

◆ testIdentifier()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testIdentifier ( )

Definition at line 209 of file CopyrightTest.php.

209 : void
210 {
211 $copyright = new Copyright(
212 $this->getRenderer(),
213 $this->getIdentifierHandler(),
214 $this->getEntry(
215 false,
216 false,
217 35,
218 'cp title',
219 'cp description',
220 'data of copyright'
221 )
222 );
223
224 $this->assertSame('identifier_35', $copyright->identifier());
225 }

◆ testIsDefaultFalse()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testIsDefaultFalse ( )

Definition at line 155 of file CopyrightTest.php.

155 : void
156 {
157 $copyright = new Copyright(
158 $this->getRenderer(),
159 $this->getIdentifierHandler(),
160 $this->getEntry(
161 false,
162 false,
163 35,
164 'cp title',
165 'cp description',
166 'data of copyright'
167 )
168 );
169
170 $this->assertFalse($copyright->isDefault());
171 }

◆ testIsDefaultTrue()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testIsDefaultTrue ( )

Definition at line 137 of file CopyrightTest.php.

137 : void
138 {
139 $copyright = new Copyright(
140 $this->getRenderer(),
141 $this->getIdentifierHandler(),
142 $this->getEntry(
143 true,
144 false,
145 35,
146 'cp title',
147 'cp description',
148 'data of copyright'
149 )
150 );
151
152 $this->assertTrue($copyright->isDefault());
153 }

◆ testIsOutdatedFalse()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testIsOutdatedFalse ( )

Definition at line 191 of file CopyrightTest.php.

191 : void
192 {
193 $copyright = new Copyright(
194 $this->getRenderer(),
195 $this->getIdentifierHandler(),
196 $this->getEntry(
197 false,
198 false,
199 35,
200 'cp title',
201 'cp description',
202 'data of copyright'
203 )
204 );
205
206 $this->assertFalse($copyright->isOutdated());
207 }

◆ testIsOutdatedTrue()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testIsOutdatedTrue ( )

Definition at line 173 of file CopyrightTest.php.

173 : void
174 {
175 $copyright = new Copyright(
176 $this->getRenderer(),
177 $this->getIdentifierHandler(),
178 $this->getEntry(
179 false,
180 true,
181 35,
182 'cp title',
183 'cp description',
184 'data of copyright'
185 )
186 );
187
188 $this->assertTrue($copyright->isOutdated());
189 }

◆ testPresentAsString()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testPresentAsString ( )

Definition at line 286 of file CopyrightTest.php.

286 : void
287 {
288 $copyright = new Copyright(
289 $this->getRenderer(),
290 $this->getIdentifierHandler(),
291 $this->getEntry(
292 false,
293 false,
294 35,
295 'cp title',
296 'cp description',
297 'data of copyright'
298 )
299 );
300
301 $this->assertSame('data of copyright', $copyright->presentAsString());
302 }

◆ testPresentAsUIComponents()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testPresentAsUIComponents ( )

@noinspection PhpUndefinedMethodInspection

Definition at line 263 of file CopyrightTest.php.

263 : void
264 {
265 $renderer = $this->getRenderer();
266 $copyright = new Copyright(
267 $renderer,
268 $this->getIdentifierHandler(),
269 $this->getEntry(
270 false,
271 false,
272 35,
273 'cp title',
274 'cp description',
275 'data of copyright'
276 )
277 );
278
279 $components = $copyright->presentAsUIComponents();
280
281 $this->assertCount(1, $components);
283 $this->assertSame('data of copyright', $renderer->exposed_copyright_data);
284 }
$components

References $components, and $renderer.

◆ testTitle()

ILIAS\MetaData\Services\CopyrightHelper\CopyrightTest::testTitle ( )

Definition at line 227 of file CopyrightTest.php.

227 : void
228 {
229 $copyright = new Copyright(
230 $this->getRenderer(),
231 $this->getIdentifierHandler(),
232 $this->getEntry(
233 false,
234 false,
235 35,
236 'cp title',
237 'cp description',
238 'data of copyright'
239 )
240 );
241
242 $this->assertSame('cp title', $copyright->title());
243 }

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