}); }); it('throws exception if callable throws a different exception', function () { shouldThrowException(function () { $expect = new Expectation(function () { throw new \Exception('test'); }); $expect->toThrow('\\ErrorException'); }); }); it('throws exception if callable does not throw an exception', function () { shouldThrowException(function () { $expect = new Expectation(function () { return; }); $expect->toThrow('\\Exception'); }); }); }); context('notToThrow', function () { it('throws an exception if the callable threw the exception', function () { shouldThrowException(function () { $expect = new Expectation(function () { throw new \Exception('test'); }); $expect->notToThrow('\\Exception'); }); }); it('returns if callable throws a different exception', function () { shouldReturn(function () { $expect = new Expectation(function () {