Mercurial > hg > isophonics-drupal-site
comparison vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/Exception.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 /* | |
3 * This file is part of the PHPUnit_MockObject package. | |
4 * | |
5 * (c) Sebastian Bergmann <sebastian@phpunit.de> | |
6 * | |
7 * For the full copyright and license information, please view the LICENSE | |
8 * file that was distributed with this source code. | |
9 */ | |
10 | |
11 use SebastianBergmann\Exporter\Exporter; | |
12 | |
13 /** | |
14 * Stubs a method by raising a user-defined exception. | |
15 * | |
16 * @since Class available since Release 1.0.0 | |
17 */ | |
18 class PHPUnit_Framework_MockObject_Stub_Exception implements PHPUnit_Framework_MockObject_Stub | |
19 { | |
20 protected $exception; | |
21 | |
22 public function __construct(Exception $exception) | |
23 { | |
24 $this->exception = $exception; | |
25 } | |
26 | |
27 public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) | |
28 { | |
29 throw $this->exception; | |
30 } | |
31 | |
32 public function toString() | |
33 { | |
34 $exporter = new Exporter; | |
35 | |
36 return sprintf( | |
37 'raise user-specified exception %s', | |
38 $exporter->export($this->exception) | |
39 ); | |
40 } | |
41 } |