| @@ 316-330 (lines=15) @@ | ||
| 313 | ); |
|
| 314 | } |
|
| 315 | ||
| 316 | public function testAfterDispatch() |
|
| 317 | { |
|
| 318 | $this->klein_app->afterDispatch( |
|
| 319 | function ($klein) { |
|
| 320 | $klein->response()->body('after callbacks!'); |
|
| 321 | } |
|
| 322 | ); |
|
| 323 | ||
| 324 | $this->klein_app->dispatch(null, null, false); |
|
| 325 | ||
| 326 | $this->assertSame( |
|
| 327 | 'after callbacks!', |
|
| 328 | $this->klein_app->response()->body() |
|
| 329 | ); |
|
| 330 | } |
|
| 331 | ||
| 332 | public function testAfterDispatchWithMultipleCallbacks() |
|
| 333 | { |
|
| @@ 354-364 (lines=11) @@ | ||
| 351 | ); |
|
| 352 | } |
|
| 353 | ||
| 354 | public function testAfterDispatchWithStringCallables() |
|
| 355 | { |
|
| 356 | $this->klein_app->afterDispatch('test_response_edit_wrapper'); |
|
| 357 | ||
| 358 | $this->klein_app->dispatch(null, null, false); |
|
| 359 | ||
| 360 | $this->assertSame( |
|
| 361 | 'after callbacks!', |
|
| 362 | $this->klein_app->response()->body() |
|
| 363 | ); |
|
| 364 | } |
|
| 365 | ||
| 366 | public function testAfterDispatchWithBadCallables() |
|
| 367 | { |
|
| @@ 170-186 (lines=17) @@ | ||
| 167 | ); |
|
| 168 | } |
|
| 169 | ||
| 170 | public function testDispatchOutputNotSent() |
|
| 171 | { |
|
| 172 | $this->klein_app->respond( |
|
| 173 | function () { |
|
| 174 | return 'test output'; |
|
| 175 | } |
|
| 176 | ); |
|
| 177 | ||
| 178 | $this->klein_app->dispatch(null, null, false); |
|
| 179 | ||
| 180 | $this->expectOutputString(''); |
|
| 181 | ||
| 182 | $this->assertSame( |
|
| 183 | 'test output', |
|
| 184 | $this->klein_app->response()->body() |
|
| 185 | ); |
|
| 186 | } |
|
| 187 | ||
| 188 | public function testDispatchOutputCaptured() |
|
| 189 | { |
|