| @@ 229-242 (lines=14) @@ | ||
| 226 | $this->assertEquals('Done', $out); |
|
| 227 | } |
|
| 228 | ||
| 229 | function testExceptionSuppression() { |
|
| 230 | $chain = new ErrorControlChainTest_Chain(); |
|
| 231 | ||
| 232 | list($out, $code) = $chain |
|
| 233 | ->then(function(){ |
|
| 234 | throw new Exception('This exception should be suppressed'); |
|
| 235 | }) |
|
| 236 | ->thenIfErrored(function(){ |
|
| 237 | echo "Done"; |
|
| 238 | }) |
|
| 239 | ->executeInSubprocess(); |
|
| 240 | ||
| 241 | $this->assertEquals('Done', $out); |
|
| 242 | } |
|
| 243 | ||
| 244 | function testErrorControl() { |
|
| 245 | $chain = new ErrorControlChainTest_Chain(); |
|
| @@ 315-333 (lines=19) @@ | ||
| 312 | $this->assertContains("Good", $out); |
|
| 313 | } |
|
| 314 | ||
| 315 | function testDoesntAffectCaughtExceptions() { |
|
| 316 | $chain = new ErrorControlChainTest_Chain(); |
|
| 317 | ||
| 318 | list($out, $code) = $chain |
|
| 319 | ->then(function(){ |
|
| 320 | try { |
|
| 321 | throw new Exception('Error'); |
|
| 322 | } |
|
| 323 | catch (Exception $e) { |
|
| 324 | echo "Good"; |
|
| 325 | } |
|
| 326 | }) |
|
| 327 | ->thenIfErrored(function(){ |
|
| 328 | echo "Bad"; |
|
| 329 | }) |
|
| 330 | ->executeInSubprocess(); |
|
| 331 | ||
| 332 | $this->assertContains("Good", $out); |
|
| 333 | } |
|
| 334 | ||
| 335 | function testDoesntAffectHandledErrors() { |
|
| 336 | $chain = new ErrorControlChainTest_Chain(); |
|