예제 #1
0
                assert($reporter == 'test', 'reporter name should be "test"');
            });
        });
        it('should emit a load event', function () {
            $command = null;
            $config = null;
            $this->emitter->on('peridot.load', function ($cmd, $cfg) use(&$command, &$config) {
                $command = $cmd;
                $config = $cfg;
            });
            $this->command->run(new ArrayInput([], $this->definition), $this->output);
            assert($command === $this->command, "command should have been received by event");
            assert($config === $this->configuration, "configuration should have been received by event");
        });
        context('when there are failing tests', function () {
            it('should return an exit code', function () {
                $suite = new Suite("fail suite", function () {
                });
                $test = new Test('fail', function () {
                    throw new Exception('fail');
                });
                $suite->addTest($test);
                $runner = new Runner($suite, $this->configuration, $this->emitter);
                $command = new Command($runner, $this->configuration, $this->factory, $this->emitter);
                $command->setApplication($this->application);
                $exit = $command->run(new ArrayInput([], $this->definition), $this->output);
                assert($exit == 1, "exit code should be 1");
            });
        });
    });
});