$expect = new Expectation(-1); $expect->notToBeWithin(-10, 10); }); }); }); context('toHaveKey', function () { it('returns if the array has the key', function () { shouldReturn(function () { $expect = new Expectation(array('test' => 'value')); $expect->toHaveKey('test'); }); }); it('throws exception if the array does not have the key', function () { shouldThrowException(function () { $expect = new Expectation(array('test' => 'value')); $expect->toHaveKey('invalid'); }); }); }); context('notToHaveKey', function () { it('returns if the array does not have the key', function () { shouldReturn(function () { $expect = new Expectation(array('test' => 'value')); $expect->notToHaveKey('randomkey'); }); }); it('throws exception if the array has the key', function () { shouldThrowException(function () { $expect = new Expectation(array('value')); $expect->notToHaveKey(0); });