Ejemplo n.º 1
0
 /**
  * The default `'reporting'` filter.
  */
 protected function _reporting()
 {
     return Filter::on($this, 'reporting', [], function ($chain) {
         $reporter = $this->reporters()->get('coverage');
         if (!$reporter) {
             return;
         }
         if ($this->args()->exists('clover')) {
             Clover::write(['collector' => $reporter, 'file' => $this->args()->get('clover')]);
         }
         if ($this->args()->exists('istanbul')) {
             Istanbul::write(['collector' => $reporter, 'file' => $this->args()->get('istanbul')]);
         }
         if ($this->args()->exists('lcov')) {
             Lcov::write(['collector' => $reporter, 'file' => $this->args()->get('lcov')]);
         }
     });
 }
Ejemplo n.º 2
0
            $code->shallNotPass();
            $collector->stop();
            $time = time();
            $success = Lcov::write(['collector' => $collector, 'file' => $this->output, 'base_path' => DS . 'home' . DS . 'crysalead' . DS . 'kahlan']);
            expect($success)->toBe(178);
            $txt = file_get_contents($this->output);
            $ds = DS;
            $expected = <<<EOD
TN:
SF:/home/crysalead/kahlan/spec/Fixture/Reporter/Coverage/NoEmptyLine.php
1,shallNotPass
FNDA:1,shallNotPass
FNF:1
FNH:1
DA:8,1
DA:10,0
DA:12,1
DA:13,0
LF:4
LH:2
end_of_record
EOD;
            expect($txt)->toBe($expected);
        });
        it("throws exception when no file is set", function () {
            expect(function () {
                Lcov::write([]);
            })->toThrow(new RuntimeException('Missing file name'));
        });
    });
});