19declare(strict_types=1);
22use PHPUnit\Framework\TestCase;
28 protected function setUp(): void
30 if (!defined(
'ANONYMOUS_USER_ID')) {
31 define(
'ANONYMOUS_USER_ID', 13);
59 $this->addToAssertionCount(1);
60 }
catch (Throwable
$e) {
63 '(unexpected %s: %s)' . PHP_EOL .
'%s',
66 $e->getTraceAsString()
80 ?
string $expected_class =
null,
81 ?
string $expected_message =
null
86 'Failed asserting that exception %s was thrown.',
87 $expected_class ??
'(any exception)'
89 }
catch (Throwable
$e) {
90 if ($expected_class !==
null && !
$e instanceof $expected_class) {
92 'Failed asserting exception of type %s. Got %s instead.',
97 if ($expected_message !==
null && !str_contains(
$e->getMessage(), $expected_message)) {
99 'Failed asserting exception message contains "%s". Actual message: "%s"',
104 $this->addToAssertionCount(1);
Customizing of pimple-DIC for ILIAS.
assertThrows(callable $cb, ?string $expected_class=null, ?string $expected_message=null)
@template T of Throwable
assertDoesNotThrow(callable $cb, string $message='')
setGlobalVariable(string $name, mixed $value)