IssueGroupTest::testGetIssues()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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