Skip to content

Commit

Permalink
Closes #795
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 18, 2020
1 parent 06961f1 commit 1894b1a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,25 @@ composer require --dev phpunit/php-code-coverage
## Usage

```php
<?php
<?php declare(strict_types=1);
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\Report\Html\Facade as HtmlReport;

$coverage = new CodeCoverage;
$filter = new Filter;
$filter->includeDirectory('/path/to/directory');

$coverage->filter()->includeDirectory('/path/to/src');
$driver = Driver::forLineCoverage($filter);

$coverage = new CodeCoverage($driver, $filter);

$coverage->start('<name of test>');

// ...

$coverage->stop();

$writer = new \SebastianBergmann\CodeCoverage\Report\Clover;
$writer->process($coverage, '/tmp/clover.xml');

$writer = new \SebastianBergmann\CodeCoverage\Report\Html\Facade;
$writer->process($coverage, '/tmp/code-coverage-report');
(new HtmlReport)->process($coverage, '/tmp/code-coverage-report');
```

0 comments on commit 1894b1a

Please sign in to comment.