WorkLogEntryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testAccessors() 0 18 1
A setUp() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TogglJiraTest\Entity;
5
6
use PHPUnit\Framework\TestCase;
7
use TogglJira\Entity\WorkLogEntry;
8
9
class WorkLogEntryTest extends TestCase
10
{
11
    /**
12
     * @var WorkLogEntry
13
     */
14
    private $entity;
15
16
    /**
17
     * @return void
18
     */
19
    public function setUp(): void
20
    {
21
        $this->entity = new WorkLogEntry();
22
    }
23
24
    /**
25
     * @throws \Exception
26
     * @return void
27
     */
28
    public function testAccessors(): void
29
    {
30
        $data = [
31
            'issueID' => 'TST-01',
32
            'timeSpent' => 666,
33
            'comment' => 'This is a test',
34
            'spentOn' => new \DateTimeImmutable()
35
        ];
36
37
        $this->entity->setIssueID($data['issueID']);
38
        $this->entity->setTimeSpent($data['timeSpent']);
39
        $this->entity->setComment($data['comment']);
40
        $this->entity->setSpentOn($data['spentOn']);
41
42
        $this->assertEquals($data['issueID'], $this->entity->getIssueID());
43
        $this->assertEquals($data['timeSpent'], $this->entity->getTimeSpent());
44
        $this->assertEquals($data['comment'], $this->entity->getComment());
45
        $this->assertEquals($data['spentOn'], $this->entity->getSpentOn());
46
    }
47
}
48