forked from sebastianbergmann/php-code-coverage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSizeTest.php
More file actions
79 lines (69 loc) · 2.65 KB
/
Copy pathTestSizeTest.php
File metadata and controls
79 lines (69 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-code-coverage.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Test\TestSize;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversClassesThatExtendClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
#[CoversClass(TestSize::class)]
#[CoversClassesThatExtendClass(TestSize::class)]
#[Small]
final class TestSizeTest extends TestCase
{
public function testCanBeUnknown(): void
{
$size = TestSize::unknown();
$this->assertTrue($size->isUnknown());
$this->assertFalse($size->isKnown());
$this->assertFalse($size->isSmall());
$this->assertFalse($size->isMedium());
$this->assertFalse($size->isLarge());
$this->assertSame('unknown', $size->asString());
}
public function testCanBeSmall(): void
{
$size = TestSize::small();
$this->assertFalse($size->isUnknown());
$this->assertTrue($size->isKnown());
$this->assertTrue($size->isSmall());
$this->assertFalse($size->isMedium());
$this->assertFalse($size->isLarge());
$this->assertSame('small', $size->asString());
}
public function testCanBeMedium(): void
{
$size = TestSize::medium();
$this->assertFalse($size->isUnknown());
$this->assertTrue($size->isKnown());
$this->assertFalse($size->isSmall());
$this->assertTrue($size->isMedium());
$this->assertFalse($size->isLarge());
$this->assertSame('medium', $size->asString());
}
public function testCanBeLarge(): void
{
$size = TestSize::large();
$this->assertFalse($size->isUnknown());
$this->assertTrue($size->isKnown());
$this->assertFalse($size->isSmall());
$this->assertFalse($size->isMedium());
$this->assertTrue($size->isLarge());
$this->assertSame('large', $size->asString());
}
public function testCanBeCompared(): void
{
$this->assertFalse(TestSize::small()->isGreaterThan(TestSize::small()));
$this->assertFalse(TestSize::medium()->isGreaterThan(TestSize::large()));
$this->assertTrue(TestSize::medium()->isGreaterThan(TestSize::small()));
$this->assertFalse(TestSize::large()->isGreaterThan(TestSize::large()));
$this->assertTrue(TestSize::large()->isGreaterThan(TestSize::small()));
$this->assertTrue(TestSize::large()->isGreaterThan(TestSize::medium()));
}
}