}); }); it('returns if callable throws a different exception', function () { shouldReturn(function () { $expect = new Expectation(function () { throw new \Exception('test'); }); $expect->notToThrow('\\ErrorException'); }); }); it('returns if callable does not throw an exception', function () { shouldReturn(function () { $expect = new Expectation(function () { return; }); $expect->notToThrow('\\Exception'); }); }); }); context('toMatch', function () { it('returns if the string matches the pattern', function () { shouldReturn(function () { $expect = new Expectation('user123'); $expect->toMatch('/\\w{4}123/'); }); }); it('throws exception if it does not match the pattern', function () { shouldThrowException(function () { $expect = new Expectation('1'); $expect->toMatch('/\\d{2}/'); });