Completed
Push — master ( 7fdc78...830b42 )
by Jonathan
11s
created

ChangelogConfigTest::testGetUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ChangelogGenerator\Tests;
6
7
use ChangelogGenerator\ChangelogConfig;
8
use PHPUnit\Framework\TestCase;
9
10
final class ChangelogConfigTest extends TestCase
11
{
12
    /** @var string */
13
    private $user;
14
15
    /** @var string */
16
    private $repository;
17
18
    /** @var string */
19
    private $milestone;
20
21
    /** @var string[] */
22
    private $labels = [];
23
24
    /** @var ChangelogConfig */
25
    private $changelogConfig;
26
27
    public function testGetUser() : void
28
    {
29
        self::assertEquals($this->user, $this->changelogConfig->getUser());
30
    }
31
32
    public function testGetRepository() : void
33
    {
34
        self::assertEquals($this->repository, $this->changelogConfig->getRepository());
35
    }
36
37
    public function testGetMilestone() : void
38
    {
39
        self::assertEquals($this->milestone, $this->changelogConfig->getMilestone());
40
    }
41
42
    public function testGetLabels() : void
43
    {
44
        self::assertEquals($this->labels, $this->changelogConfig->getLabels());
45
    }
46
47
    public function testGetMilestoneIssuesUrl() : void
48
    {
49
        self::assertEquals('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed+label%3AEnhancement', $this->changelogConfig->getMilestoneIssuesUrl('Enhancement'));
50
    }
51
52
    public function testGetMilestoneIssuesUrlNoLabel() : void
53
    {
54
        self::assertEquals('https://api.github.com/search/issues?q=milestone%3A%221.0%22+repo%3Ajwage%2Fchangelog-generator+state%3Aclosed', $this->changelogConfig->getMilestoneIssuesUrl(''));
55
    }
56
57
    protected function setUp() : void
58
    {
59
        $this->user       = 'jwage';
60
        $this->repository = 'changelog-generator';
61
        $this->milestone  = '1.0';
62
        $this->labels     = ['Enhancement', 'Bug'];
63
64
        $this->changelogConfig = new ChangelogConfig(
65
            $this->user,
66
            $this->repository,
67
            $this->milestone,
68
            $this->labels
69
        );
70
    }
71
}
72