ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
IncidentTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Test\Access\test
;
22
23
use
Exception
;
24
use
PHPUnit\Framework\TestCase
;
25
use
ILIAS\Test\Access\Incident
;
26
27
class
IncidentTest
extends
TestCase
28
{
29
public
function
testConstruct
(): void
30
{
31
$this->assertInstanceOf(Incident::class,
new
Incident());
32
}
33
34
public
function
testAny
(): void
35
{
36
$this->assertTrue((
new
Incident())->any(
static
fn(
int
$x) => $x === 2, [1, 2, 3]));
37
}
38
39
public
function
testAnyBreaksAtFirstTrue
(): void
40
{
41
$throw_error =
false
;
42
43
$this->assertTrue((
new
Incident())->any(
static
function
(
int
$x) use (&$throw_error):
bool
{
44
if
($throw_error) {
45
throw
new
Exception
(
'Should not be called anymore.'
);
46
}
47
return
$x === 2 && ($throw_error =
true
);
48
}, [1, 2, 3]));
49
}
50
51
public
function
testAnyReturnsFalse
(): void
52
{
53
$this->assertFalse((
new
Incident())->any(
static
fn(
int
$x) =>
false
, [1, 2, 3]));
54
}
55
}
ILIAS\Style\Content\Access::test\IncidentTest\testAnyBreaksAtFirstTrue
testAnyBreaksAtFirstTrue()
Definition:
IncidentTest.php:39
ILIAS\Style\Content\Access::test\IncidentTest\testAny
testAny()
Definition:
IncidentTest.php:34
ILIAS\Style\Content\Access::test\IncidentTest\testAnyReturnsFalse
testAnyReturnsFalse()
Definition:
IncidentTest.php:51
ILIAS\Style\Content\Access::test\IncidentTest
Definition:
IncidentTest.php:27
Incident
ILIAS\Test\Access\test
Definition:
AccessFileUploadAnswerTest.php:21
ILIAS\Style\Content\Access::test\IncidentTest\testConstruct
testConstruct()
Definition:
IncidentTest.php:29
TestCase
Exception
components
ILIAS
Test
tests
IncidentTest.php
Generated on Sun Aug 31 2025 23:04:00 for ILIAS by
1.8.13 (using
Doxyfile
)