kahlan\Log::type PHP Method

type() public method

Gets the type of the report.
public type ( $type = null ) : string
return string
    public function type($type = null)
    {
        if (!func_num_args()) {
            return $this->_type;
        }
        $this->_type = $type;
        return $this;
    }

Usage Example

Beispiel #1
0
<?php

namespace Kahlan\Spec\Suite;

use Exception;
use Kahlan\Log;
use Kahlan\Scope;
describe("Log", function () {
    describe("->__construct()", function () {
        it("correctly sets default values", function () {
            $log = new Log();
            expect($log->scope())->toBe(null);
            expect($log->type())->toBe('passed');
            expect($log->not())->toBe(false);
            expect($log->description())->toBe(null);
            expect($log->matcher())->toBe(null);
            expect($log->matcherName())->toBe(null);
            expect($log->data())->toBe([]);
            expect($log->backtrace())->toBe([]);
            expect($log->exception())->toBe(null);
            expect($log->file())->toBe(null);
            expect($log->line())->toBe(null);
            expect($log->children())->toBe([]);
        });
    });
    describe("->add()", function () {
        beforeEach(function () {
            $this->scope = new Scope();
            $this->pattern = '*Suite.php';
            $this->regExp = strtr(preg_quote($this->pattern, '~'), ['\\*' => '.*', '\\?' => '.']);
            $this->scope->backtraceFocus($this->pattern);