ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\test\WiringTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\test\WiringTest:
+ Collaboration diagram for ILIAS\LegalDocuments\test\WiringTest:

Public Member Functions

 testConstruct ()
 
 testAfterLogin ()
 
 testShowInFooter ()
 
 testCanWithdraw ()
 
 testShowOnLoginPage ()
 
 testHasAgreement ()
 
 testHasHistory ()
 
 testOnSelfRegistration ()
 
 testHasOnlineStatusFilter ()
 
 testCanReadInternalMails ()
 
 testCanUseSoapApi ()
 
 testHasDocuments ()
 
 testHasUserManagementFields ()
 
 testHasPublicApi ()
 
 testHasPublicPage ()
 
 testHasPublicPageWithGotoLink ()
 
 testMap ()
 

Detailed Description

Definition at line 38 of file WiringTest.php.

Member Function Documentation

◆ testAfterLogin()

ILIAS\LegalDocuments\test\WiringTest::testAfterLogin ( )

Definition at line 47 of file WiringTest.php.

47 : void
48 {
49 $map = $this->mock(Map::class);
50 $proc = $this->fail(...);
51
52 $instance = new Wiring($this->mock(SlotConstructor::class), $this->mockMethod(Map::class, 'add', ['after-login', $proc], $map));
53 $this->assertSame($map, $instance->afterLogin($proc)->map());
54 }

◆ testCanReadInternalMails()

ILIAS\LegalDocuments\test\WiringTest::testCanReadInternalMails ( )

Definition at line 142 of file WiringTest.php.

142 : void
143 {
144 $map = $this->mock(Map::class);
145 $constraint = $this->mock(Constraint::class);
146
147 $instance = new Wiring($this->mock(SlotConstructor::class), $this->mockMethod(Map::class, 'add', ['constrain-internal-mail', $constraint], $map));
148 $this->assertSame($map, $instance->canReadInternalMails($constraint)->map());
149 }

◆ testCanUseSoapApi()

ILIAS\LegalDocuments\test\WiringTest::testCanUseSoapApi ( )

Definition at line 151 of file WiringTest.php.

151 : void
152 {
153 $map = $this->mock(Map::class);
154 $constraint = $this->mock(Constraint::class);
155
156 $instance = new Wiring($this->mock(SlotConstructor::class), $this->mockMethod(Map::class, 'add', ['use-soap-api', $constraint], $map));
157 $this->assertSame($map, $instance->canUseSoapApi($constraint)->map());
158 }

◆ testCanWithdraw()

ILIAS\LegalDocuments\test\WiringTest::testCanWithdraw ( )

Definition at line 65 of file WiringTest.php.

65 : void
66 {
67 $withdraw_process = $this->mock(WithdrawProcess::class);
68
69 $instance = new Wiring($this->mock(SlotConstructor::class), new Map());
70
71 $map = $instance->canWithdraw($withdraw_process)->map()->value();
72
73 $this->assertSame([
74 'withdraw',
75 'intercept',
76 'logout-text',
77 'show-on-login-page',
78 ], array_keys($map));
79
80 $this->assertTrue(array_is_list($map['intercept']));
81 $this->assertTrue(array_is_list($map['show-on-login-page']));
82 $this->assertFalse(array_is_list($map['withdraw']));
83 $this->assertFalse(array_is_list($map['logout-text']));
84 }

◆ testConstruct()

ILIAS\LegalDocuments\test\WiringTest::testConstruct ( )

Definition at line 42 of file WiringTest.php.

42 : void
43 {
44 $this->assertInstanceOf(Wiring::class, new Wiring($this->mock(SlotConstructor::class), $this->mock(Map::class)));
45 }

◆ testHasAgreement()

ILIAS\LegalDocuments\test\WiringTest::testHasAgreement ( )

Definition at line 93 of file WiringTest.php.

93 : void
94 {
95 $instance = new Wiring($this->mock(SlotConstructor::class), new Map());
96 $map = $instance->hasAgreement($this->mock(Agreement::class), 'bar')->map()->value();
97
98 $this->assertSame([
99 'public-page',
100 'agreement-form',
101 'intercept',
102 'goto',
103 ], array_keys($map));
104
105 $this->assertFalse(array_is_list($map['public-page']));
106 $this->assertFalse(array_is_list($map['agreement-form']));
107 $this->assertTrue(array_is_list($map['intercept']));
108 $this->assertTrue(array_is_list($map['goto']));
109 }

◆ testHasDocuments()

ILIAS\LegalDocuments\test\WiringTest::testHasDocuments ( )

Definition at line 160 of file WiringTest.php.

160 : void
161 {
162 $instance = new Wiring($this->mock(SlotConstructor::class), new Map());
163 $map = $instance->hasDocuments([], new SelectionMap())->map()->value();
164
165 $this->assertSame([
166 'document',
167 'writable-document',
168 ], array_keys($map));
169
170 $this->assertFalse(array_is_list($map['document']));
171 $this->assertFalse(array_is_list($map['writable-document']));
172 }

◆ testHasHistory()

ILIAS\LegalDocuments\test\WiringTest::testHasHistory ( )

Definition at line 111 of file WiringTest.php.

111 : void
112 {
113 $document = $this->mock(ProvideDocument::class);
114 $history = $this->mock(ProvideHistory::class);
115 $slot = $this->mockMethod(SlotConstructor::class, 'history', [$document], $history);
116 $slot->method('id')->willReturn('foo');
117 $map = $this->mockTree(Map::class, ['value' => ['document' => ['foo' => $document]]]);
118 $map->expects(self::once())->method('set')->with('history', 'foo', $history)->willReturn($map);
119
120 $instance = new Wiring($slot, $map);
121 $this->assertSame($map, $instance->hasHistory()->map());
122 }

◆ testHasOnlineStatusFilter()

ILIAS\LegalDocuments\test\WiringTest::testHasOnlineStatusFilter ( )

Definition at line 133 of file WiringTest.php.

133 : void
134 {
135 $map = $this->mock(Map::class);
136 $proc = $this->fail(...);
137
138 $instance = new Wiring($this->mock(SlotConstructor::class), $this->mockMethod(Map::class, 'add', ['filter-online-users', $proc], $map));
139 $this->assertSame($map, $instance->hasOnlineStatusFilter($proc)->map());
140 }

◆ testHasPublicApi()

ILIAS\LegalDocuments\test\WiringTest::testHasPublicApi ( )

Definition at line 187 of file WiringTest.php.

187 : void
188 {
189 $map = $this->mock(Map::class);
190 $public_api = $this->mock(PublicApi::class);
191
192 $instance = new Wiring(
193 $this->mockTree(SlotConstructor::class, ['id' => 'foo']),
194 $this->mockMethod(Map::class, 'set', ['public-api', 'foo', $public_api], $map)
195 );
196
197 $this->assertSame($map, $instance->hasPublicApi($public_api)->map());
198 }

◆ testHasPublicPage()

ILIAS\LegalDocuments\test\WiringTest::testHasPublicPage ( )

Definition at line 200 of file WiringTest.php.

200 : void
201 {
202 $map = $this->mock(Map::class);
203 $public_page = fn() => null;
204
205 $instance = new Wiring(
206 $this->mockTree(SlotConstructor::class, ['id' => 'foo']),
207 $this->mockMethod(Map::class, 'set', ['public-page', 'foo', $public_page], $map)
208 );
209
210 $this->assertSame($map, $instance->hasPublicPage($public_page)->map());
211 }

◆ testHasPublicPageWithGotoLink()

ILIAS\LegalDocuments\test\WiringTest::testHasPublicPageWithGotoLink ( )

Definition at line 213 of file WiringTest.php.

213 : void
214 {
215 $m = $this->mock(Map::class);
216 $map = $this->mockMethod(Map::class, 'add', ['goto'], $m);
217 $public_page = fn() => null;
218
219 $instance = new Wiring(
220 $this->mockTree(SlotConstructor::class, ['id' => 'foo']),
221 $this->mockMethod(Map::class, 'set', ['public-page', 'foo', $public_page], $map)
222 );
223
224 $this->assertSame($m, $instance->hasPublicPage($public_page, 'foo')->map());
225 }

◆ testHasUserManagementFields()

ILIAS\LegalDocuments\test\WiringTest::testHasUserManagementFields ( )

Definition at line 174 of file WiringTest.php.

174 : void
175 {
176 $map = $this->mock(Map::class);
177 $proc = $this->fail(...);
178
179 $instance = new Wiring(
180 $this->mockTree(SlotConstructor::class, ['id' => 'foo']),
181 $this->mockMethod(Map::class, 'set', ['user-management-fields', 'foo', $proc], $map)
182 );
183
184 $this->assertSame($map, $instance->hasUserManagementFields($proc)->map());
185 }

◆ testMap()

ILIAS\LegalDocuments\test\WiringTest::testMap ( )

Definition at line 227 of file WiringTest.php.

227 : void
228 {
229 $map = $this->mock(Map::class);
230 $this->assertSame($map, (new Wiring($this->mock(SlotConstructor::class), $map))->map());
231 }

◆ testOnSelfRegistration()

ILIAS\LegalDocuments\test\WiringTest::testOnSelfRegistration ( )

Definition at line 124 of file WiringTest.php.

124 : void
125 {
126 $map = $this->mock(Map::class);
127 $self_registration = $this->mock(SelfRegistration::class);
128
129 $instance = new Wiring($this->mock(SlotConstructor::class), $this->mockMethod(Map::class, 'add', ['self-registration', $self_registration], $map));
130 $this->assertSame($map, $instance->onSelfRegistration($self_registration)->map());
131 }

◆ testShowInFooter()

ILIAS\LegalDocuments\test\WiringTest::testShowInFooter ( )

Definition at line 56 of file WiringTest.php.

56 : void
57 {
58 $map = $this->mock(Map::class);
59 $proc = $this->fail(...);
60
61 $instance = new Wiring($this->mockTree(SlotConstructor::class, ['id' => 'foo']), $this->mockMethod(Map::class, 'set', ['footer', 'foo', $proc], $map));
62 $this->assertSame($map, $instance->showInFooter($proc)->map());
63 }

◆ testShowOnLoginPage()

ILIAS\LegalDocuments\test\WiringTest::testShowOnLoginPage ( )

Definition at line 86 of file WiringTest.php.

86 : void
87 {
88 $proc = $this->fail(...);
89 $instance = new Wiring($this->mockTree(SlotConstructor::class, ['id' => 'foo']), new Map());
90 $this->assertSame(['show-on-login-page' => ['foo' => $proc]], $instance->showOnLoginPage($proc)->map()->value());
91 }

The documentation for this class was generated from the following file: