add() public method

Adds an expectation report and emits a report event.
public add ( $type, array $data = [] )
$data array The report data.
Beispiel #1
0
        it("returns `true` type is `'skipped'`", function () {
            $log = new Log(['type' => 'skipped']);
            expect($log->passed())->toBe(true);
        });
        it("returns `true` type is `'excluded'`", function () {
            $log = new Log(['type' => 'excluded']);
            expect($log->passed())->toBe(true);
        });
        it("returns `false` type is `'failed'`", function () {
            $log = new Log(['type' => 'failed']);
            expect($log->passed())->toBe(false);
        });
        it("returns `false` type is `'errored'`", function () {
            $log = new Log(['type' => 'errored']);
            expect($log->passed())->toBe(false);
        });
        it("returns `true` when logged exceptions passed", function () {
            $log = new Log();
            $log->add('passed', []);
            $log->add('passed', []);
            expect($log->passed())->toBe(true);
        });
        it("returns `false` when some logged exceptions failed", function () {
            $log = new Log();
            $log->add('passed', []);
            $log->add('passed', []);
            $log->add('failed', []);
            expect($log->passed())->toBe(false);
        });
    });
});
Beispiel #2
0
         $this->result->log(new Log(['type' => 'passed']));
         $this->result->log(new Log(['type' => 'pending']));
         $this->result->log(new Log(['type' => 'skipped']));
         $this->result->log(new Log(['type' => 'excluded']));
         $this->result->log(new Log(['type' => 'failed']));
         $this->result->log(new Log(['type' => 'errored']));
         expect($this->result->total())->toBe(6);
     });
 });
 describe("->expectation()", function () {
     it("gets the total number of expectations", function () {
         $log1 = new Log();
         $log1->add('passed', []);
         $log1->add('passed', []);
         $log2 = new Log();
         $log2->add('failed', []);
         $log1->add('passed', []);
         $log2->add('failed', []);
         $log2->add('failed', []);
         $log2->add('failed', []);
         $this->result->log($log1);
         $this->result->log($log2);
         expect($this->result->expectation())->toBe(7);
     });
 });
 describe("->__call()", function () {
     it("gets number of passed specs", function () {
         $this->result->log(new Log(['type' => 'passed']));
         expect($this->result->passed())->toBe(1);
     });
     it("gets number of pending specs", function () {