it('throws exception if the array has the key', function () { shouldThrowException(function () { $expect = new Expectation(['value']); $expect->notToHaveKey(0); }); }); }); context('custom matchers', function () { it('can be added with addMatcher', function () { shouldThrowException(function () { Expectation::addMatcher('toTest', 'pho\\spec\\Expectation\\Matcher\\MockMatcher'); $expect = new Expectation('a'); $expect->toTest('b'); }); $expect = new Expectation('a'); $expect->toTest('a'); }); it('can be called in their negated form', function () { shouldThrowException(function () { Expectation::addMatcher('toTest', 'pho\\spec\\Expectation\\Matcher\\MockMatcher'); $expect = new Expectation('a'); $expect->notToTest('a'); }); $expect = new Expectation('a'); $expect->notToTest('b'); }); }); it('throws a BadMethodCallException with an invalid method', function () { shouldThrowException(function () { $expect = new Expectation('test'); $expect->invalidMethod();