Esempio n. 1
0
    if (!$exceptionThrown) {
        throw new \Exception('Does not throw exception');
    }
}
describe('Expectation', function () {
    context('toBeA', function () {
        it('returns if the value has the expected type', function () {
            shouldReturn(function () {
                $expect = new Expectation('test');
                $expect->toBeA('string');
            });
        });
        it('throws exception if not of the expected type', function () {
            shouldThrowException(function () {
                $expect = new Expectation(1);
                $expect->toBeA('string');
            });
        });
    });
    context('notToBeA', function () {
        it('returns if the value is not the given type', function () {
            shouldReturn(function () {
                $expect = new Expectation(1);
                $expect->notToBeA('string');
            });
        });
        it('throws exception if it is of the given type', function () {
            shouldThrowException(function () {
                $expect = new Expectation('test');
                $expect->notToBeA('string');
            });