IssueFactoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 16
c 2
b 0
f 0
dl 0
loc 26
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreate() 0 17 1
A setUp() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ChangelogGenerator\Tests;
6
7
use ChangelogGenerator\IssueFactory;
8
use PHPUnit\Framework\TestCase;
9
10
final class IssueFactoryTest extends TestCase
11
{
12
    private IssueFactory $issueFactory;
13
14
    public function testCreate(): void
15
    {
16
        $issue = $this->issueFactory->create([
17
            'number' => 1,
18
            'title' => '[Test] _ Title',
19
            'body' => 'Test Body',
20
            'html_url' => 'https://google.com',
21
            'user' => ['login' => 'jwage'],
22
            'labels' => [['name' => 'Enhancement']],
23
        ]);
24
25
        self::assertSame(1, $issue->getNumber());
26
        self::assertSame('&#91;Test&#93; &#95; Title', $issue->getTitle());
27
        self::assertSame('Test Body', $issue->getBody());
28
        self::assertSame('https://google.com', $issue->getUrl());
29
        self::assertSame('jwage', $issue->getUser());
30
        self::assertSame(['Enhancement'], $issue->getLabels());
31
    }
32
33
    protected function setUp(): void
34
    {
35
        $this->issueFactory = new IssueFactory();
36
    }
37
}
38