ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
AuthenticatedUserSubjectProviderTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use PHPUnit\Framework\TestCase;
25
27{
29 {
30 $subject = (new AuthenticatedUserSubjectProvider())->subjectFor(42);
31
32 self::assertSame('authentication', $subject->provider());
33 self::assertSame('42', $subject->id());
34 self::assertSame(AuthenticatedUserSubjectProvider::class, $subject->providerClass());
35 }
36
37 public function testZeroIsRejected(): void
38 {
39 $this->expectException(\InvalidArgumentException::class);
40 $this->expectExceptionMessage('User ID must be positive, got 0.');
41
42 (new AuthenticatedUserSubjectProvider())->subjectFor(0);
43 }
44
45 public function testANegativeIdIsRejected(): void
46 {
47 $this->expectException(\InvalidArgumentException::class);
48 $this->expectExceptionMessage('User ID must be positive, got -1.');
49
50 (new AuthenticatedUserSubjectProvider())->subjectFor(-1);
51 }
52}
Names the fully authenticated ILIAS users as KeyValueStorage subjects; the subject id is the user id.