IssueGroupTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 36
rs 10
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\MockObject\MockObject;
10
use PHPUnit\Framework\TestCase;
11
12
final class IssueGroupTest extends TestCase
13
{
14
    private string $name;
15
16
    /** @phpstan-var (Issue&MockObject)[] */
17
    private array $issues = [];
18
19
    private IssueGroup $issueGroup;
20
21
    public function testGetName(): void
22
    {
23
        self::assertSame($this->name, $this->issueGroup->getName());
24
    }
25
26
    public function testGetIssues(): void
27
    {
28
        self::assertSame($this->issues, $this->issueGroup->getIssues());
29
    }
30
31
    public function testAddIssue(): void
32
    {
33
        self::assertCount(1, $this->issueGroup->getIssues());
34
35
        $issue = $this->createMock(Issue::class);
36
37
        $this->issueGroup->addIssue($issue);
38
39
        self::assertCount(2, $this->issueGroup->getIssues());
40
    }
41
42
    protected function setUp(): void
43
    {
44
        $this->name   = 'Enhancement';
45
        $this->issues = [$this->createMock(Issue::class)];
46
47
        $this->issueGroup = new IssueGroup($this->name, $this->issues);
48
    }
49
}
50