Skip to content

Instantly share code, notes, and snippets.



Last active Dec 16, 2015
What would you like to do?
public function assertThrowsException($exception, $code)
$raisedException = null;
try {
} catch (\Exception $raisedException) {
// No more code, we only want to catch the exception in $raisedException.
$this->assertInstanceOf($exception, $raisedException);
public function testGizmo()
$widget = 'something';
// Some more code
$this->assertThrowsException('\Package\Specific\Exception', function () use ($widget) {
$blah = new \Package\Gizmo($widget);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.