export() public static method

Exports a coverage to a string.
public static export ( array $options ) : string
$options array The option array where the possible values are: -`'collector'` _object_ : The collector instance. -`'repo_token'` _string_ : The Coveralls repo token. -`'head'` _string_ : The HEAD hash. -`'branch'` _string_ : The branch name. -`'committed_at'` _integer_: The committed timestamp. -`'environment'` _array_ : The Environment. Possible values are: -`'pwd'` _string_ : The repo absolute path. -`'ci_service'` _string_ : The CI service name - `'name` _string_ : CI service name - `'build_identifier` _string_ : build identifier - `'build_url` _string_ : build url - `'branch` _string_ : branch name - `'commit_sha` _string_ : commit SHA - `'pull_request` _string_ : pull request id -`'run_at'` _integer_: The runned timestamp.
return string
Beispiel #1
0
         expect(array_filter($coverage))->toHaveLength(2);
         expect(array_filter($coverage, function ($value) {
             return $value === 0;
         }))->toHaveLength(2);
         expect(array_filter($coverage, function ($value) {
             return $value === null;
         }))->toHaveLength(11);
     });
     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();
         $json = CodeClimate::export(['collector' => $collector, 'repo_token' => 'ABC', 'ci' => ['name' => 'kahlan-ci', 'build_identifier' => '123']]);
         $actual = json_decode($json, true);
         $coverage = $actual['source_files'][0];
         expect($coverage['name'])->toBe($path);
         $coverage = json_decode($coverage['coverage']);
         expect($coverage)->toHaveLength(16);
         expect(array_filter($coverage, function ($value) {
             return $value === 0;
         }))->toHaveLength(2);
         expect(array_filter($coverage, function ($value) {
             return $value === null;
         }))->toHaveLength(12);
     });
 });
 describe("::write()", function () {
     beforeEach(function () {