예제 #1
0
             $expect = new Expectation(1.1);
             $expect->toBeWithin(0, 1);
         });
     });
 });
 context('notToBeWithin', function () {
     it('returns if the value is not within the range', function () {
         shouldReturn(function () {
             $expect = new Expectation(2);
             $expect->notToBeWithin(1, 1.9);
         });
     });
     it('throws exception if the value is within the range', function () {
         shouldThrowException(function () {
             $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');
         });