testHasDescriptionWillReturnFalseWhenNotSet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArpTest\Entity;
6
7
use ArpTest\Entity\Double\DescriptionAwareFake;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * @covers \Arp\Entity\DescriptionAwareTrait
12
 * @covers \ArpTest\Entity\Double\DescriptionAwareFake
13
 *
14
 * @author  Alex Patterson <[email protected]>
15
 * @package ArpTest\Entity
16
 */
17
final class DescriptionAwareTraitTest extends TestCase
18
{
19
    public function testHasDescriptionWillReturnFalseIfTheDescriptionIsEmpty(): void
20
    {
21
        $descriptionAware = new DescriptionAwareFake();
22
23
        $this->assertFalse($descriptionAware->hasDescription());
24
    }
25
26
    public function testGetDescriptionWillReturnEmptyStringWhenNotSet(): void
27
    {
28
        $descriptionAware = new DescriptionAwareFake();
29
30
        $this->assertSame('', $descriptionAware->getDescription());
31
    }
32
33
    public function testHasDescriptionWillReturnFalseWhenNotSet(): void
34
    {
35
        $descriptionAware = new DescriptionAwareFake();
36
37
        $this->assertFalse($descriptionAware->hasDescription());
38
    }
39
40
    public function testHasDescriptionWillReturnTrueWhenSet(): void
41
    {
42
        $descriptionAware = new DescriptionAwareFake();
43
44
        $descriptionAware->setDescription('This is a test description text');
45
46
        $this->assertTrue($descriptionAware->hasDescription());
47
    }
48
49
    public function testSetAndGetDescription(): void
50
    {
51
        $descriptionAware = new DescriptionAwareFake();
52
53
        $this->assertSame('', $descriptionAware->getDescription());
54
55
        $description = 'Hello World!';
56
        $descriptionAware->setDescription($description);
57
58
        $this->assertSame($description, $descriptionAware->getDescription());
59
    }
60
}
61