ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
◀ ilDoc Overview
AuthenticatedUserSubjectProviderTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Tests\Authentication\KeyValueStorage
;
22
23
use
ILIAS\Authentication\KeyValueStorage\AuthenticatedUserSubjectProvider
;
24
use PHPUnit\Framework\TestCase;
25
26
class
AuthenticatedUserSubjectProviderTest
extends
TestCase
27
{
28
public
function
testTheSubjectOfAUserIsItsIdWithinThisProvider
(): void
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
}
ILIAS\Authentication\KeyValueStorage\AuthenticatedUserSubjectProvider
Names the fully authenticated ILIAS users as KeyValueStorage subjects; the subject id is the user id.
Definition:
AuthenticatedUserSubjectProvider.php:34
ILIAS\Tests\Authentication\KeyValueStorage\AuthenticatedUserSubjectProviderTest
Definition:
AuthenticatedUserSubjectProviderTest.php:27
ILIAS\Tests\Authentication\KeyValueStorage\AuthenticatedUserSubjectProviderTest\testANegativeIdIsRejected
testANegativeIdIsRejected()
Definition:
AuthenticatedUserSubjectProviderTest.php:45
ILIAS\Tests\Authentication\KeyValueStorage\AuthenticatedUserSubjectProviderTest\testTheSubjectOfAUserIsItsIdWithinThisProvider
testTheSubjectOfAUserIsItsIdWithinThisProvider()
Definition:
AuthenticatedUserSubjectProviderTest.php:28
ILIAS\Tests\Authentication\KeyValueStorage\AuthenticatedUserSubjectProviderTest\testZeroIsRejected
testZeroIsRejected()
Definition:
AuthenticatedUserSubjectProviderTest.php:37
ILIAS\Tests\Authentication\KeyValueStorage
Definition:
AuthenticatedSubjectPurgeTest.php:21
components
ILIAS
Authentication
tests
KeyValueStorage
AuthenticatedUserSubjectProviderTest.php
Generated on Wed Nov 11 2026 23:05:37 for ILIAS by
1.9.4 (using
Doxyfile
)