Completed
Pull Request — master (#15)
by Marco
02:37
created

RevisionTest::invalidRevisionProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace RoaveTest\ApiCompare\Git;
5
6
use InvalidArgumentException;
7
use Roave\ApiCompare\Git\Revision;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * @covers \Roave\ApiCompare\Git\Revision
12
 */
13
final class RevisionTest extends TestCase
14
{
15
    public function testFromSha1WithValidSha1() : void
16
    {
17
        $sha1 = sha1(uniqid('sha1', true));
18
19
        self::assertSame($sha1, (string)Revision::fromSha1($sha1));
20
    }
21
22
    public function invalidRevisionProvider() : array
23
    {
24
        return [
25
            [''],
26
            ['a'],
27
            [str_repeat('a', 39)],
28
            [str_repeat('a', 41)],
29
        ];
30
    }
31
32
    /**
33
     * @param string $invalidRevision
34
     * @dataProvider invalidRevisionProvider
35
     */
36
    public function testInvalidSha1Rejected(string $invalidRevision) : void
37
    {
38
        $this->expectException(InvalidArgumentException::class);
39
        Revision::fromSha1($invalidRevision);
40
    }
41
}
42