Definition at line 43 of file UserTest.php.
◆ ensureDefined()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::ensureDefined |
( |
string |
$name, |
|
|
|
$value |
|
) |
| |
|
private |
◆ externalAuthModes()
static ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::externalAuthModes |
( |
| ) |
|
|
static |
◆ testAcceptAnyDocument()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testAcceptAnyDocument |
( |
| ) |
|
Definition at line 385 of file UserTest.php.
387 $user = $this->mock(ilObjUser::class);
388 $history = $this->mock(ProvideHistory::class);
389 $doc = $this->mock(Document::class);
390 $history->expects(self::once())->method(
'acceptDocument')->with($user, $doc);
392 $instance =
new User(
394 $this->mock(Settings::class),
395 $this->mock(UserSettings::class),
396 $this->mockTree(Provide::class, [
397 'document' => [
'repository' => [
'all' => [$doc]]],
398 'history' => $history,
400 $this->mock(Clock::class)
403 $instance->acceptAnyDocument();
◆ testAcceptedVersion()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testAcceptedVersion |
( |
| ) |
|
Definition at line 257 of file UserTest.php.
References ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest\ensureDefined().
262 $result = $this->mock(Result::class);
264 $user = $this->mockTree(ilObjUser::class, [
'getId' => 67]);
266 $instance =
new User(
268 $this->mock(Settings::class),
269 $this->mockTree(UserSettings::class, [
'agreeDate' => [
'value' =>
new DateTimeImmutable()]]),
270 $this->mockTree(Provide::class, [
'history' => $this->mockMethod(ProvideHistory::class,
'acceptedVersion', [$user], $result)]),
271 $this->mock(Clock::class)
274 $this->assertSame($result, $instance->acceptedVersion());
◆ testAcceptMatchingDocument()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testAcceptMatchingDocument |
( |
| ) |
|
Definition at line 297 of file UserTest.php.
References ILIAS\$setting.
299 $user = $this->mock(ilObjUser::class);
300 $document = $this->mock(Document::class);
303 $history = $this->mock(ProvideHistory::class);
304 $history->expects(self::once())->method(
'acceptDocument')->with($user, $document);
306 $setting = $this->mock(Setting::class);
307 $setting->expects(self::once())->method(
'update')->with($date);
309 $instance =
new User(
311 $this->mock(Settings::class),
312 $this->mockTree(UserSettings::class, [
'agreeDate' =>
$setting]),
313 $this->mockTree(Provide::class, [
314 'document' => $this->mockMethod(ProvideDocument::class,
'chooseDocumentFor', [$user],
new Ok($document)),
315 'history' => $history,
317 $this->mockTree(Clock::class, [
'now' => $date])
320 $instance->acceptMatchingDocument();
◆ testAcceptVersionError()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testAcceptVersionError |
( |
| ) |
|
Definition at line 277 of file UserTest.php.
References ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest\ensureDefined(), and null.
282 $user = $this->mockTree(ilObjUser::class, [
'getId' => 67]);
284 $instance =
new User(
286 $this->mock(Settings::class),
287 $this->mockTree(UserSettings::class, [
'agreeDate' => [
'value' =>
null]]),
288 $this->mock(Provide::class),
289 $this->mock(Clock::class)
292 $result = $instance->acceptedVersion();
293 $this->assertFalse($result->isOk());
294 $this->assertSame(
'User never agreed.', $result->error());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testAgreeDate()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testAgreeDate |
( |
| ) |
|
Definition at line 138 of file UserTest.php.
References ILIAS\$setting.
140 $setting = $this->mock(Setting::class);
142 $instance =
new User(
143 $this->mock(ilObjUser::class),
144 $this->mock(Settings::class),
145 $this->mockMethod(UserSettings::class,
'agreeDate', [],
$setting),
146 $this->mock(Provide::class),
147 $this->mock(Clock::class)
150 $this->assertSame(
$setting, $instance->agreeDate());
◆ testCannotAgree()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testCannotAgree |
( |
| ) |
|
Definition at line 80 of file UserTest.php.
References ANONYMOUS_USER_ID, ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest\ensureDefined(), and SYSTEM_USER_ID.
85 $user = $this->mock(ilObjUser::class);
90 $this->mock(Settings::class),
91 $this->mock(UserSettings::class),
92 $this->mock(Provide::class),
93 $this->mock(Clock::class)
96 $this->assertTrue($instance->cannotAgree());
97 $this->assertTrue($instance->cannotAgree());
98 $this->assertTrue($instance->cannotAgree());
99 $this->assertFalse($instance->cannotAgree());
100 $this->assertFalse($instance->cannotAgree());
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
◆ testConstruct()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testConstruct |
( |
| ) |
|
Definition at line 47 of file UserTest.php.
49 $this->assertInstanceOf(User::class,
new User(
50 $this->mock(ilObjUser::class),
51 $this->mock(Settings::class),
52 $this->mock(UserSettings::class),
53 $this->mock(Provide::class),
54 $this->mock(Clock::class)
◆ testDidNotAcceptCurrentVersion()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testDidNotAcceptCurrentVersion |
( |
| ) |
|
Definition at line 153 of file UserTest.php.
155 $user = $this->mock(ilObjUser::class);
156 $document = $this->mock(Document::class);
158 $instance =
new User(
160 $this->mockTree(Settings::class, [
'validateOnLogin' => [
'value' =>
true]]),
161 $this->mock(UserSettings::class),
162 $this->mockTree(Provide::class, [
163 'document' => $this->mockMethod(ProvideDocument::class,
'chooseDocumentFor', [$user],
new Ok($document)),
164 'history' => $this->mockMethod(ProvideHistory::class,
'alreadyAccepted', [$user, $document],
false),
166 $this->mock(Clock::class)
169 $this->assertTrue($instance->didNotAcceptCurrentVersion());
◆ testDoesntMatch()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testDoesntMatch |
( |
| ) |
|
Definition at line 221 of file UserTest.php.
223 $document = $this->mock(Document::class);
224 $user = $this->mock(ilObjUser::class);
226 $instance =
new User(
228 $this->mock(Settings::class),
229 $this->mock(UserSettings::class),
230 $this->mockTree(Provide::class, [
231 'document' => $this->mockMethod(ProvideDocument::class,
'documentMatches', [$document, $user],
true),
233 $this->mock(Clock::class)
236 $this->assertFalse($instance->doesntMatch($document));
◆ testFormat()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testFormat |
( |
| ) |
|
Definition at line 352 of file UserTest.php.
354 $instance =
new User(
355 $this->mockTree(ilObjUser::class, [
356 'getFullname' =>
'foo',
358 'getExternalAccount' =>
'baz',
360 $this->mock(Settings::class),
361 $this->mock(UserSettings::class),
362 $this->mock(Provide::class),
363 $this->mock(Clock::class)
366 $this->assertSame(
'', $instance->format(
''));
367 $this->assertSame(
"hej foo bar\nbaz", $instance->format(
'hej %s %s[BR]%s'));
◆ testIsExternalUser()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testIsExternalUser |
( |
int |
$auth_mode, |
|
|
bool |
$is_external_account |
|
) |
| |
externalAuthModes
Definition at line 339 of file UserTest.php.
341 $instance =
new User(
342 $this->mockTree(ilObjUser::class, [
'getAuthMode' =>
'default']),
343 $this->mockTree(Settings::class, [
'authMode' => [
'value' => (
string) $auth_mode]]),
344 $this->mock(UserSettings::class),
345 $this->mock(Provide::class),
346 $this->mock(Clock::class)
349 $this->assertSame($is_external_account, $instance->isExternalAccount());
◆ testIsLDAPUser()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testIsLDAPUser |
( |
| ) |
|
Definition at line 323 of file UserTest.php.
References ilAuthUtils\AUTH_LDAP.
325 $instance =
new User(
326 $this->mockTree(ilObjUser::class, [
'getAuthMode' =>
'default']),
328 $this->mock(UserSettings::class),
329 $this->mock(Provide::class),
330 $this->mock(Clock::class)
333 $this->assertTrue($instance->isLDAPUser());
◆ testIsLoggedIn()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testIsLoggedIn |
( |
| ) |
|
Definition at line 58 of file UserTest.php.
References ANONYMOUS_USER_ID, and ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest\ensureDefined().
62 $user = $this->mock(ilObjUser::class);
63 $user->expects(self::exactly(5))->method(
'getId')->willReturnOnConsecutiveCalls(0,
ANONYMOUS_USER_ID, 9, 1, 68);
67 $this->mock(Settings::class),
68 $this->mock(UserSettings::class),
69 $this->mock(Provide::class),
70 $this->mock(Clock::class)
73 $this->assertFalse($instance->isLoggedIn());
74 $this->assertFalse($instance->isLoggedIn());
75 $this->assertTrue($instance->isLoggedIn());
76 $this->assertTrue($instance->isLoggedIn());
77 $this->assertTrue($instance->isLoggedIn());
◆ testMatchingDocument()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testMatchingDocument |
( |
| ) |
|
Definition at line 239 of file UserTest.php.
241 $user = $this->mock(ilObjUser::class);
242 $result = $this->mock(Result::class);
244 $instance =
new User(
246 $this->mock(Settings::class),
247 $this->mock(UserSettings::class),
248 $this->mockTree(Provide::class, [
249 'document' => $this->mockMethod(ProvideDocument::class,
'chooseDocumentFor', [$user], $result),
251 $this->mock(Clock::class)
254 $this->assertSame($result, $instance->matchingDocument());
◆ testNeedsToAcceptNewDocumentReturnsFalse()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testNeedsToAcceptNewDocumentReturnsFalse |
( |
| ) |
|
Definition at line 201 of file UserTest.php.
203 $user = $this->mock(ilObjUser::class);
204 $document = $this->mock(Document::class);
205 $history = $this->mockMethod(ProvideHistory::class,
'currentDocumentOfAcceptedVersion', [$user],
new Ok($document));
207 $instance =
new User(
209 $this->mockTree(Settings::class, [
'validateOnLogin' => [
'value' =>
true]]),
210 $this->mockTree(UserSettings::class, [
'agreeDate' => [
'value' =>
new DateTimeImmutable()]]),
211 $this->mockTree(Provide::class, [
212 'document' => $this->mockMethod(ProvideDocument::class,
'documentMatches', [$document, $user],
true),
213 'history' => $history,
215 $this->mock(Clock::class)
218 $this->assertFalse($instance->needsToAcceptNewDocument());
◆ testNeedsToAcceptNewDocumentReturnsTrue()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testNeedsToAcceptNewDocumentReturnsTrue |
( |
| ) |
|
Definition at line 185 of file UserTest.php.
187 $user = $this->mock(ilObjUser::class);
188 $history = $this->mockMethod(ProvideHistory::class,
'currentDocumentOfAcceptedVersion', [$user],
new Error(
'Not found.'));
190 $instance =
new User(
192 $this->mockTree(Settings::class, [
'validateOnLogin' => [
'value' =>
true]]),
193 $this->mockTree(UserSettings::class, [
'agreeDate' => [
'value' =>
new DateTimeImmutable()]]),
194 $this->mockTree(Provide::class, [
'history' => $history]),
195 $this->mock(Clock::class)
198 $this->assertTrue($instance->needsToAcceptNewDocument());
◆ testNeedsToAcceptNewDocumentWhereNeverAgreed()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testNeedsToAcceptNewDocumentWhereNeverAgreed |
( |
| ) |
|
Definition at line 172 of file UserTest.php.
References null.
174 $instance =
new User(
175 $this->mock(ilObjUser::class),
176 $this->mock(Settings::class),
177 $this->mockTree(UserSettings::class, [
'agreeDate' => [
'value' =>
null]]),
178 $this->mock(Provide::class),
179 $this->mock(Clock::class)
182 $this->assertTrue($instance->needsToAcceptNewDocument());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testNeverAgreed()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testNeverAgreed |
( |
| ) |
|
Definition at line 103 of file UserTest.php.
References ILIAS\$setting, and null.
105 $setting = $this->mock(Setting::class);
108 $user_settings = $this->mock(UserSettings::class);
109 $user_settings->expects(self::exactly(2))->method(
'agreeDate')->willReturn(
$setting);
111 $instance =
new User(
112 $this->mock(ilObjUser::class),
113 $this->mock(Settings::class),
115 $this->mock(Provide::class),
116 $this->mock(Clock::class)
119 $this->assertTrue($instance->neverAgreed());
120 $this->assertFalse($instance->neverAgreed());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testRaw()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testRaw |
( |
| ) |
|
Definition at line 370 of file UserTest.php.
372 $user = $this->mock(ilObjUser::class);
374 $instance =
new User(
376 $this->mock(Settings::class),
377 $this->mock(UserSettings::class),
378 $this->mock(Provide::class),
379 $this->mock(Clock::class)
382 $this->assertSame($user, $instance->raw());
◆ testWithdrawalRequested()
ILIAS\LegalDocuments\test\ConsumerToolbox\UserTest::testWithdrawalRequested |
( |
| ) |
|
Definition at line 123 of file UserTest.php.
References ILIAS\$setting.
125 $setting = $this->mock(Setting::class);
127 $instance =
new User(
128 $this->mock(ilObjUser::class),
129 $this->mock(Settings::class),
130 $this->mockMethod(UserSettings::class,
'withdrawalRequested', [],
$setting),
131 $this->mock(Provide::class),
132 $this->mock(Clock::class)
135 $this->assertSame(
$setting, $instance->withdrawalRequested());
The documentation for this class was generated from the following file:
- components/ILIAS/LegalDocuments/tests/ConsumerToolbox/UserTest.php