19 declare(strict_types=1);
34 require_once __DIR__ .
'/../../ContainerMock.php';
42 $this->assertInstanceOf(Agreement::class,
new Agreement(
43 $this->mock(User::class),
44 $this->mock(UI::class),
45 $this->mock(Routing::class),
53 $this->mockTree(User::class, [
'matchingDocument' =>
new Ok($this->mock(Document::class))]),
54 $this->mock(UI::class),
55 $this->mock(Routing::class),
59 $this->assertInstanceOf(ShowOnScreenMessage::class, $instance->showAgreement(
'foo',
'bar'));
65 $this->mockTree(User::class, [
'matchingDocument' =>
new Ok($this->mock(Document::class))]),
66 $this->mock(UI::class),
67 $this->mock(Routing::class),
68 fn() => $this->mock(Component::class)
71 $this->assertInstanceOf(ShowOnScreenMessage::class, $instance->showAgreementForm(
'foo',
'bar'));
77 $this->mockTree(User::class, [
78 'cannotAgree' =>
false,
79 'neverAgreed' =>
false,
80 'didNotAcceptCurrentVersion' =>
false,
82 $this->mock(UI::class),
83 $this->mock(Routing::class),
87 $this->assertFalse($instance->needsToAgree());
93 $this->mockTree(User::class, [
94 'cannotAgree' =>
true,
95 'didNotAcceptCurrentVersion' =>
true,
97 $this->mock(UI::class),
98 $this->mock(Routing::class),
102 $this->assertFalse($instance->needsToAgree());
108 $this->mockTree(User::class, [
109 'cannotAgree' =>
false,
110 'needsToAcceptNewDocument' =>
true,
112 $this->mock(UI::class),
113 $this->mock(Routing::class),
117 $this->assertTrue($instance->needsToAgree());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A result encapsulates a value or an error and simplifies the handling of those.