Exemple #1
0
                });
            });
            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 = Stub::create();
            $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 = Stub::create();
            expect($reporters)->toReceive('process')->with('stop', Arg::toMatch(function ($actual) {
                return isset($actual['specs']) && isset($actual['focuses']);
            }));
            $this->suite->run(['reporters' => $reporters]);
            $this->suite->stop();
            expect($this->suite->reporters())->toBe($reporters);
        });
    });
});
Exemple #2
0
         expect($this->patchers->patchable('ClassName'))->toBe(false);
     });
 });
 describe("->process()", function () {
     it("runs a method on all patchers", function () {
         $stub1 = Double::instance();
         $this->patchers->add('patcher1', $stub1);
         $stub2 = Double::instance();
         $this->patchers->add('patcher2', $stub2);
         $path = 'tmp/hello_world.php';
         $code = "<?php\necho 'Hello World!';\n";
         $matcher = function ($actual) use($code) {
             return $code === (string) $actual;
         };
         expect($stub1)->toReceive('process')->with(Arg::toMatch($matcher), $path);
         expect($stub2)->toReceive('process')->with(Arg::toMatch($matcher), $path);
         $this->patchers->process($code, $path);
     });
     it("bails out if code to process is an empty string", function () {
         expect($this->patchers->process(''))->toBe('');
     });
 });
 describe("->findFile()", function () {
     beforeEach(function () {
         $this->loader = Double::instance();
         $this->class = Double::classname();
         $this->file = 'some/path/file.php';
         $this->stub1 = Double::instance();
         $this->patchers->add('patcher1', $this->stub1);
         $this->stub2 = Double::instance();
         $this->patchers->add('patcher2', $this->stub2);