Exemplo n.º 1
0
     */
    afterAll(function () {
        Interceptor::load($this->previous);
    });
    describe("::enable()", function () {
        it("enables quit statements", function () {
            Quit::disable();
            expect(Quit::enabled())->toBe(false);
            Quit::enable();
            expect(Quit::enabled())->toBe(true);
        });
    });
    describe("::disable()", function () {
        it("disables quit statements", function () {
            Quit::enable();
            expect(Quit::enabled())->toBe(true);
            Quit::disable();
            expect(Quit::enabled())->toBe(false);
        });
    });
    describe("::disable()", function () {
        it("throws an exception when an exit statement occurs if not allowed", function () {
            Quit::disable();
            $closure = function () {
                $foo = new Foo();
                $foo->exitStatement(-1);
            };
            expect($closure)->toThrow(new QuitException('Exit statement occurred', -1));
        });
    });
});