<metrics loc="15" ncloc="11" statements="4" coveredstatements="2"/> </project> </coverage> EOD; expect($xml)->toBe($expected); }); it("exports the coverage of a file with an extra line at the end", function () { $path = 'spec' . DS . 'Fixture' . DS . 'Reporter' . DS . 'Coverage' . DS . 'ExtraEmptyLine.php'; $collector = new Collector(['driver' => $this->driver, 'path' => $path]); $code = new ExtraEmptyLine(); $collector->start(); $code->shallNotPass(); $collector->stop(); $time = time(); $xml = Clover::export(['collector' => $collector, 'time' => $time, 'base_path' => DS . 'home' . DS . 'crysalead' . DS . 'kahlan']); $ds = DS; $expected = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <coverage generated="{$time}"> <project timestamp="{$time}"> <file name="{$ds}home{$ds}crysalead{$ds}kahlan{$ds}spec{$ds}Fixture{$ds}Reporter{$ds}Coverage{$ds}ExtraEmptyLine.php"> <line num="8" type="stmt" count="1"/> <line num="10" type="stmt" count="0"/> <line num="12" type="stmt" count="1"/> <line num="13" type="stmt" count="0"/> </file> <metrics loc="16" ncloc="12" statements="4" coveredstatements="2"/> </project> </coverage>
<metrics loc="15" ncloc="11" statements="4" coveredstatements="2"/> </project> </coverage> EOD; expect($xml)->toBe($expected); }); it("exports the coverage of a file with an extra line at the end", function () { $path = 'spec/fixture/reporter/coverage/ExtraEmptyLine.php'; $collector = new Collector(['driver' => new Xdebug(), 'path' => $path]); $code = new ExtraEmptyLine(); $collector->start(); $code->shallNotPass(); $collector->stop(); $time = time(); $xml = Clover::export(['collector' => $collector, 'time' => $time, 'base_path' => '/home/crysalead/kahlan']); $expected = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <coverage generated="{$time}"> <project timestamp="{$time}"> <file name="/home/crysalead/kahlan/spec/fixture/reporter/coverage/ExtraEmptyLine.php"> <line num="8" type="stmt" count="1"/> <line num="10" type="stmt" count="0"/> <line num="12" type="stmt" count="1"/> <line num="13" type="stmt" count="0"/> </file> <metrics loc="16" ncloc="12" statements="4" coveredstatements="2"/> </project> </coverage> EOD;