Completed
Pull Request — master (#450)
by Michael
11:54 queued 06:04
created

TextnodeHitchTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 48
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetSourceTextnode() 0 8 1
A testGetTargetTextnode() 0 8 1
A testGetDescription() 0 6 1
A testGetId() 0 6 1
1
<?php
2
/* Copyright (C) 2018 Michael Giesler
3
 *
4
 * This file is part of Dembelo.
5
 *
6
 * Dembelo is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * Dembelo is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Affero General Public License 3 for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License 3
17
 * along with Dembelo. If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
namespace DembeloMain\Tests\Document;
21
22
use DembeloMain\Document\Textnode;
23
use DembeloMain\Document\TextnodeHitch;
24
use PHPUnit\Framework\TestCase;
25
26
/**
27
 * Class TextnodeHitchTest
28
 * @package DembeloMain\Tests\Document
29
 */
30
class TextnodeHitchTest extends TestCase
31
{
32
    /**
33
     * @return void
34
     */
35
    public function testGetId(): void
36
    {
37
        $hitch = new TextnodeHitch();
38
        self::assertNull($hitch->getId());
39
        $hitch->setId('someId');
40
        self::assertEquals('someId', $hitch->getId());
41
    }
42
43
    /**
44
     * @return void
45
     */
46
    public function testGetDescription(): void
47
    {
48
        $hitch = new TextnodeHitch();
49
        self::assertNull($hitch->getDescription());
50
        $hitch->setDescription('someDescription');
51
        self::assertEquals('someDescription', $hitch->getDescription());
52
    }
53
54
    /**
55
     * @return void
56
     */
57
    public function testGetTargetTextnode(): void
58
    {
59
        /** @var Textnode|\PHPUnit_Framework_MockObject_MockObject $textnodeMock */
60
        $textnodeMock = $this->createMock(Textnode::class);
61
        $hitch = new TextnodeHitch();
62
        self::assertNull($hitch->getTargetTextnode());
63
        $hitch->setTargetTextnode($textnodeMock);
64
        self::assertSame($textnodeMock, $hitch->getTargetTextnode());
65
    }
66
67
    /**
68
     * @return void
69
     */
70
    public function testGetSourceTextnode(): void
71
    {
72
        /** @var Textnode|\PHPUnit_Framework_MockObject_MockObject $textnodeMock */
73
        $textnodeMock = $this->createMock(Textnode::class);
74
        $hitch = new TextnodeHitch();
75
        self::assertNull($hitch->getSourceTextnode());
76
        $hitch->setSourceTextnode($textnodeMock);
77
        self::assertSame($textnodeMock, $hitch->getSourceTextnode());
78
    }
79
}