예제 #1
0
     $this->console = $console;
     $suite = new Suite('test', function () {
     });
     $spec = new Spec('testspec', function () {
     }, $suite);
     $this->spec = $spec;
 });
 it('implements the ReporterInterface', function () {
     $reporter = new ListReporter($this->console);
     expect($reporter instanceof ReporterInterface)->toBe(true);
 });
 context('beforeSpec', function () {
     it('increments the spec count', function () {
         $reporter = new ListReporter($this->console);
         $countBefore = $reporter->getSpecCount();
         $reporter->beforeSpec($this->spec);
         $countAfter = $reporter->getSpecCount();
         expect($countAfter)->toEqual($countBefore + 1);
     });
 });
 context('afterSpec', function () {
     it('prints the full spec string in grey if it passed', function () {
         $reporter = new ListReporter($this->console);
         $afterSpec = function () use($reporter) {
             $reporter->afterSpec($this->spec);
         };
         $console = $this->console;
         $title = $this->console->formatter->grey($this->spec);
         expect($afterSpec)->toPrint($title . PHP_EOL);
     });
     it('prints the full spec string in red if it failed', function () {
예제 #2
0
     $console = new Console(array(), 'php://output');
     $console->parseArguments();
     $suite = new Suite('test', function () {
     });
     $spec = new Spec('testspec', function () {
     }, $suite);
 });
 it('implements the ReporterInterface', function () use(&$console) {
     $reporter = new ListReporter($console);
     expect($reporter instanceof ReporterInterface)->toBeTrue();
 });
 context('beforeSpec', function () use(&$console, &$spec) {
     it('increments the spec count', function () use(&$console, &$spec) {
         $reporter = new ListReporter($console);
         $countBefore = $reporter->getSpecCount();
         $reporter->beforeSpec($spec);
         $countAfter = $reporter->getSpecCount();
         expect($countAfter)->toEqual($countBefore + 1);
     });
 });
 context('afterSpec', function () use(&$console, &$spec) {
     it('prints the full spec string in grey if it passed', function () use(&$console, &$spec) {
         $reporter = new ListReporter($console);
         $afterSpec = function () use($reporter, &$spec) {
             $reporter->afterSpec($spec);
         };
         $title = $console->formatter->grey($spec);
         expect($afterSpec)->toPrint($title . PHP_EOL);
     });
     it('prints the full spec string in red if it failed', function () use(&$console, $spec) {
         $suite = new Suite('test', function () {