Esempio n. 1
0
             $this->it("an it", function () {
                 $this->exectuted['it']++;
             });
             $this->it("an it", function () {
                 $this->exectuted['it']++;
             });
         });
         $reporters = Stub::create();
         expect($reporters)->toReceive('process')->with('start', ['total' => 2]);
         expect($reporters)->toReceiveNext('process')->with('suiteStart', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('specStart', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('skip', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('specEnd', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('specStart', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('skip', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('suiteEnd', Arg::toBeAnInstanceOf('kahlan\\Report'));
         expect($reporters)->toReceiveNext('process')->with('end', Arg::toBeAn('array'));
         $this->suite->run(['reporters' => $reporters]);
         expect($describe->exectuted)->toEqual(['it' => 0]);
         expect($this->suite->focused())->toBe(false);
         expect($this->suite->status())->toBe(0);
         expect($this->suite->passed())->toBe(true);
     });
 });
 describe("::hash()", function () {
     it("creates an hash from objects", function () {
         $instance = new stdClass();
         $hash1 = Suite::hash($instance);
         $hash2 = Suite::hash($instance);
         $hash3 = Suite::hash(new stdClass());
         expect($hash1)->toBe($hash2);
Esempio n. 2
0
                        $this->expect($closure)->not->toThrow();
                    });
                });
            });
            error_reporting(E_ALL ^ E_NOTICE);
            $this->suite->run();
            error_reporting(E_ALL);
            expect($this->suite->passed())->toBe(true);
        });
    });
    describe("->reporters()", function () {
        it("returns the reporters", function () {
            $describe = $this->suite->describe("", function () {
            });
            $reporters = Double::instance();
            $this->suite->run(['reporters' => $reporters]);
            expect($this->suite->reporters())->toBe($reporters);
        });
    });
    describe("->stop()", function () {
        it("sends the stop event", function () {
            $describe = $this->suite->describe("", function () {
            });
            $reporters = Double::instance();
            expect($reporters)->toReceive('dispatch')->with('stop', Arg::toBeAnInstanceOf('Kahlan\\Summary'));
            $this->suite->run(['reporters' => $reporters]);
            $this->suite->stop();
            expect($this->suite->reporters())->toBe($reporters);
        });
    });
});