@@ 61-73 (lines=13) @@ | ||
58 | $this->assertEquals('no', $resp->getOriginalContent()); |
|
59 | } |
|
60 | ||
61 | public function testV1ValidateActionWithLockFailed() |
|
62 | { |
|
63 | $request = $this->getValidRequest(); |
|
64 | $controller = Mockery::mock(ValidateController::class) |
|
65 | ->makePartial() |
|
66 | ->shouldAllowMockingProtectedMethods() |
|
67 | ->shouldReceive('lockTicket') |
|
68 | ->andReturn(false) |
|
69 | ->getMock(); |
|
70 | $resp = $controller->v1ValidateAction($request); |
|
71 | $this->assertInstanceOf(Response::class, $resp); |
|
72 | $this->assertEquals('no', $resp->getOriginalContent()); |
|
73 | } |
|
74 | ||
75 | public function testV1ValidateActionWithInvalidTicket() |
|
76 | { |
|
@@ 143-161 (lines=19) @@ | ||
140 | $this->assertEquals('yes', $resp->getOriginalContent()); |
|
141 | } |
|
142 | ||
143 | public function testV2ServiceValidateAction() |
|
144 | { |
|
145 | $controller = Mockery::mock(ValidateController::class) |
|
146 | ->makePartial() |
|
147 | ->shouldAllowMockingProtectedMethods() |
|
148 | ->shouldReceive('casValidate') |
|
149 | ->andReturnUsing( |
|
150 | function ($request, $returnAttr, $allowProxy) { |
|
151 | $this->assertFalse($returnAttr); |
|
152 | $this->assertFalse($allowProxy); |
|
153 | ||
154 | return 'casValidate called'; |
|
155 | } |
|
156 | ) |
|
157 | ->once() |
|
158 | ->getMock(); |
|
159 | $request = Mockery::mock(Request::class); |
|
160 | $this->assertEquals('casValidate called', $controller->v2ServiceValidateAction($request)); |
|
161 | } |
|
162 | ||
163 | public function testV2ProxyValidateAction() |
|
164 | { |
|
@@ 163-181 (lines=19) @@ | ||
160 | $this->assertEquals('casValidate called', $controller->v2ServiceValidateAction($request)); |
|
161 | } |
|
162 | ||
163 | public function testV2ProxyValidateAction() |
|
164 | { |
|
165 | $controller = Mockery::mock(ValidateController::class) |
|
166 | ->makePartial() |
|
167 | ->shouldAllowMockingProtectedMethods() |
|
168 | ->shouldReceive('casValidate') |
|
169 | ->andReturnUsing( |
|
170 | function ($request, $returnAttr, $allowProxy) { |
|
171 | $this->assertFalse($returnAttr); |
|
172 | $this->assertTrue($allowProxy); |
|
173 | ||
174 | return 'casValidate called'; |
|
175 | } |
|
176 | ) |
|
177 | ->once() |
|
178 | ->getMock(); |
|
179 | $request = Mockery::mock(Request::class); |
|
180 | $this->assertEquals('casValidate called', $controller->v2ProxyValidateAction($request)); |
|
181 | } |
|
182 | ||
183 | public function testV3ServiceValidateAction() |
|
184 | { |
|
@@ 183-201 (lines=19) @@ | ||
180 | $this->assertEquals('casValidate called', $controller->v2ProxyValidateAction($request)); |
|
181 | } |
|
182 | ||
183 | public function testV3ServiceValidateAction() |
|
184 | { |
|
185 | $controller = Mockery::mock(ValidateController::class) |
|
186 | ->makePartial() |
|
187 | ->shouldAllowMockingProtectedMethods() |
|
188 | ->shouldReceive('casValidate') |
|
189 | ->andReturnUsing( |
|
190 | function ($request, $returnAttr, $allowProxy) { |
|
191 | $this->assertTrue($returnAttr); |
|
192 | $this->assertFalse($allowProxy); |
|
193 | ||
194 | return 'casValidate called'; |
|
195 | } |
|
196 | ) |
|
197 | ->once() |
|
198 | ->getMock(); |
|
199 | $request = Mockery::mock(Request::class); |
|
200 | $this->assertEquals('casValidate called', $controller->v3ServiceValidateAction($request)); |
|
201 | } |
|
202 | ||
203 | public function testV3ProxyValidateAction() |
|
204 | { |
|
@@ 203-221 (lines=19) @@ | ||
200 | $this->assertEquals('casValidate called', $controller->v3ServiceValidateAction($request)); |
|
201 | } |
|
202 | ||
203 | public function testV3ProxyValidateAction() |
|
204 | { |
|
205 | $controller = Mockery::mock(ValidateController::class) |
|
206 | ->makePartial() |
|
207 | ->shouldAllowMockingProtectedMethods() |
|
208 | ->shouldReceive('casValidate') |
|
209 | ->andReturnUsing( |
|
210 | function ($request, $returnAttr, $allowProxy) { |
|
211 | $this->assertTrue($returnAttr); |
|
212 | $this->assertTrue($allowProxy); |
|
213 | ||
214 | return 'casValidate called'; |
|
215 | } |
|
216 | ) |
|
217 | ->once() |
|
218 | ->getMock(); |
|
219 | $request = Mockery::mock(Request::class); |
|
220 | $this->assertEquals('casValidate called', $controller->v3ProxyValidateAction($request)); |
|
221 | } |
|
222 | ||
223 | public function testProxyActionWithInvalidRequest() |
|
224 | { |