Completed
Push — master ( aaccd5...c6e65b )
by Jonathan
10s
created

IssueGroupTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testGetIssues() 0 3 1
A testAddIssue() 0 9 1
A testGetName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ChangelogGenerator\Tests;
6
7
use ChangelogGenerator\Issue;
8
use ChangelogGenerator\IssueGroup;
9
use PHPUnit\Framework\TestCase;
10
11
final class IssueGroupTest extends TestCase
12
{
13
    /** @var string */
14
    private $name;
15
16
    /** @var Issue[]|\PHPUnit_Framework_MockObject_MockObject[] */
17
    private $issues = [];
18
19
    /** @var IssueGroup */
20
    private $issueGroup;
21
22
    public function testGetName() : void
23
    {
24
        self::assertEquals($this->name, $this->issueGroup->getName());
25
    }
26
27
    public function testGetIssues() : void
28
    {
29
        self::assertEquals($this->issues, $this->issueGroup->getIssues());
30
    }
31
32
    public function testAddIssue() : void
33
    {
34
        self::assertCount(1, $this->issueGroup->getIssues());
35
36
        $issue = $this->createMock(Issue::class);
37
38
        $this->issueGroup->addIssue($issue);
39
40
        self::assertCount(2, $this->issueGroup->getIssues());
41
    }
42
43
    protected function setUp() : void
44
    {
45
        $this->name   = 'Enhancement';
46
        $this->issues = [$this->createMock(Issue::class)];
47
48
        $this->issueGroup = new IssueGroup($this->name, $this->issues);
49
    }
50
}
51