type() public method

Set/get the scope type.
public type ( $type = null ) : mixed
return mixed
Beispiel #1
0
use Exception;
use Kahlan\SkipException;
use Kahlan\Scope;
use Kahlan\Summary;
use Kahlan\Log;
describe("Scope", function () {
    beforeEach(function () {
        $this->scope = new Scope(['message' => 'it runs a spec']);
    });
    describe("->__construct()", function () {
        it("sets passed options", function () {
            $log = new Log();
            $summary = new Summary();
            $scope = new Scope(['type' => 'focus', 'message' => 'test', 'parent' => null, 'root' => null, 'log' => $log, 'timeout' => 10, 'summary' => $summary]);
            expect($scope->type())->toBe('focus');
            expect($scope->message())->toBe('test');
            expect($scope->parent())->toBe(null);
            expect($scope->log())->toBe($log);
            expect($scope->summary())->toBe($summary);
        });
    });
    describe("->parent()", function () {
        it("returns the parent node", function () {
            $parent = new Scope();
            $this->scope = new Scope(['parent' => $parent]);
            expect($this->scope->parent())->toBe($parent);
        });
    });
    describe("->backtrace()", function () {
        it("returns the backtrace", function () {