|
@@ 115-125 (lines=11) @@
|
| 112 |
|
* @param Description $expectation A text describing what was expected |
| 113 |
|
* @throws GovernorAssertionError |
| 114 |
|
*/ |
| 115 |
|
public function reportUnexpectedException(\Exception $actualException, |
| 116 |
|
Description $expectation) |
| 117 |
|
{ |
| 118 |
|
$str = "The command handler threw an unexpected exception"; |
| 119 |
|
$str .= PHP_EOL . PHP_EOL; |
| 120 |
|
$str .= "Expected <" . $expectation . "> but got <exception of type ["; |
| 121 |
|
$str .= get_class($actualException) . "]>. Stack trace follows:" . PHP_EOL; |
| 122 |
|
$str .= $this->writeStackTrace($actualException) . PHP_EOL; |
| 123 |
|
|
| 124 |
|
throw new GovernorAssertionError($str); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
/** |
| 128 |
|
* Reports an error due to a wrong return value. |
|
@@ 172-182 (lines=11) @@
|
| 169 |
|
* @param Description $description A description describing the expected value |
| 170 |
|
* @throws GovernorAssertionError |
| 171 |
|
*/ |
| 172 |
|
public function reportWrongException(\Exception $actualException, |
| 173 |
|
Description $description) |
| 174 |
|
{ |
| 175 |
|
$str = "The command handler threw an exception, but not of the expected type"; |
| 176 |
|
$str .= PHP_EOL . PHP_EOL; |
| 177 |
|
$str .= "Expected <" . $description . "> but got <exception of type ["; |
| 178 |
|
$str .= get_class($actualException) . "]>. Stacktrace follows: "; |
| 179 |
|
$str .= PHP_EOL . $this->writeStackTrace($actualException) . PHP_EOL; |
| 180 |
|
|
| 181 |
|
throw new GovernorAssertionError($str); |
| 182 |
|
} |
| 183 |
|
|
| 184 |
|
/** |
| 185 |
|
* Report an error due to a difference in on of the fields of an event. |