mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
first
This commit is contained in:
32
tests/Unit/Actions/AddsCoverage.php
Normal file
32
tests/Unit/Actions/AddsCoverage.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Pest\Actions\AddsCoverage;
|
||||
use Pest\TestSuite;
|
||||
|
||||
it('adds coverage if --coverage exist', function () {
|
||||
$testSuite = new TestSuite(getcwd());
|
||||
assertFalse($testSuite->coverage);
|
||||
|
||||
$arguments = AddsCoverage::from($testSuite, []);
|
||||
assertEquals([], $arguments);
|
||||
assertFalse($testSuite->coverage);
|
||||
|
||||
$arguments = AddsCoverage::from($testSuite, ['--coverage']);
|
||||
assertEquals(['--coverage-php', \Pest\Console\Coverage::getPath()], $arguments);
|
||||
assertTrue($testSuite->coverage);
|
||||
});
|
||||
|
||||
it('adds coverage if --min exist', function () {
|
||||
$testSuite = new TestSuite(getcwd());
|
||||
assertEquals($testSuite->coverageMin, 0.0);
|
||||
|
||||
assertFalse($testSuite->coverage);
|
||||
AddsCoverage::from($testSuite, []);
|
||||
assertEquals($testSuite->coverageMin, 0.0);
|
||||
|
||||
AddsCoverage::from($testSuite, ['--min=2']);
|
||||
assertEquals($testSuite->coverageMin, 2.0);
|
||||
|
||||
AddsCoverage::from($testSuite, ['--min=2.4']);
|
||||
assertEquals($testSuite->coverageMin, 2.4);
|
||||
});
|
||||
Reference in New Issue
Block a user