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
|
|
|
*/ |
29
|
|
|
class TextnodeHitchTest extends TestCase |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @return void |
33
|
|
|
*/ |
34
|
|
|
public function testGetId(): void |
35
|
|
|
{ |
36
|
|
|
$hitch = new TextnodeHitch(); |
37
|
|
|
self::assertNull($hitch->getId()); |
38
|
|
|
$hitch->setId('someId'); |
39
|
|
|
self::assertEquals('someId', $hitch->getId()); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return void |
44
|
|
|
*/ |
45
|
|
|
public function testGetDescription(): void |
46
|
|
|
{ |
47
|
|
|
$hitch = new TextnodeHitch(); |
48
|
|
|
self::assertNull($hitch->getDescription()); |
49
|
|
|
$hitch->setDescription('someDescription'); |
50
|
|
|
self::assertEquals('someDescription', $hitch->getDescription()); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return void |
55
|
|
|
*/ |
56
|
|
|
public function testGetTargetTextnode(): void |
57
|
|
|
{ |
58
|
|
|
/** @var Textnode|\PHPUnit_Framework_MockObject_MockObject $textnodeMock */ |
59
|
|
|
$textnodeMock = $this->createMock(Textnode::class); |
60
|
|
|
$hitch = new TextnodeHitch(); |
61
|
|
|
self::assertNull($hitch->getTargetTextnode()); |
62
|
|
|
$hitch->setTargetTextnode($textnodeMock); |
63
|
|
|
self::assertSame($textnodeMock, $hitch->getTargetTextnode()); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return void |
68
|
|
|
*/ |
69
|
|
|
public function testGetSourceTextnode(): void |
70
|
|
|
{ |
71
|
|
|
/** @var Textnode|\PHPUnit_Framework_MockObject_MockObject $textnodeMock */ |
72
|
|
|
$textnodeMock = $this->createMock(Textnode::class); |
73
|
|
|
$hitch = new TextnodeHitch(); |
74
|
|
|
self::assertNull($hitch->getSourceTextnode()); |
75
|
|
|
$hitch->setSourceTextnode($textnodeMock); |
76
|
|
|
self::assertSame($textnodeMock, $hitch->getSourceTextnode()); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|