ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
AccessCheckTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\Attributes\PreserveGlobalState;
24use PHPUnit\Framework\Attributes\RunInSeparateProcess;
25use PHPUnit\Framework\TestCase;
26
27class AccessCheckTest extends TestCase
28{
29 #[RunInSeparateProcess]
30 #[PreserveGlobalState(false)]
31 public function testAUserOfTheSystemIsKnown(): void
32 {
33 define('ANONYMOUS_USER_ID', 13);
34
35 $this->assertTrue(AccessCheck::isKnownUser(6));
36 }
37
38 #[RunInSeparateProcess]
39 #[PreserveGlobalState(false)]
41 {
42 define('ANONYMOUS_USER_ID', 13);
43
44 $this->assertFalse(AccessCheck::isKnownUser(0));
45 $this->assertFalse(AccessCheck::isKnownUser(-1));
46 $this->assertFalse(AccessCheck::isKnownUser(13));
47 }
48
53 #[RunInSeparateProcess]
54 #[PreserveGlobalState(false)]
56 {
57 $this->assertFalse(defined('ANONYMOUS_USER_ID'));
58 $this->assertFalse(AccessCheck::isKnownUser(6));
59 $this->assertFalse(AccessCheck::isKnownUser(13));
60 }
61}
testWithoutTheAnonymousUserNobodyIsKnown()
Without the id of the anonymous user it cannot be told apart - so nobody is known rather than everybo...