-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ferror\OpenapiCoverage\Unit; | ||
|
||
use Ferror\OpenapiCoverage\Coverage; | ||
use InvalidArgumentException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class CoverageTest extends TestCase | ||
{ | ||
public function testThrowsException(): void | ||
{ | ||
$this->expectException(InvalidArgumentException::class); | ||
|
||
new Coverage(-1); | ||
} | ||
|
||
public function testIsGreater(): void | ||
{ | ||
$coverage = new Coverage(50.0); | ||
|
||
$this->assertTrue($coverage->isGreater(new Coverage(40.0))); | ||
$this->assertTrue($coverage->isGreater(new Coverage(10.0))); | ||
|
||
$this->assertFalse($coverage->isGreater(new Coverage(50.0))); | ||
$this->assertFalse($coverage->isGreater(new Coverage(60.0))); | ||
$this->assertFalse($coverage->isGreater(new Coverage(100.0))); | ||
} | ||
|
||
public function testIsLower(): void | ||
{ | ||
$coverage = new Coverage(50.0); | ||
|
||
$this->assertFalse($coverage->isLower(new Coverage(40.0))); | ||
$this->assertFalse($coverage->isLower(new Coverage(10.0))); | ||
$this->assertFalse($coverage->isLower(new Coverage(50.0))); | ||
|
||
$this->assertTrue($coverage->isLower(new Coverage(60.0))); | ||
$this->assertTrue($coverage->isLower(new Coverage(100.0))); | ||
} | ||
} |