1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace KamiYang\ProjectVersion\Tests\Unit\Service; |
5
|
|
|
|
6
|
|
|
/* |
7
|
|
|
* This file is part of the ProjectVersion project. |
8
|
|
|
* |
9
|
|
|
* It is free software: you can redistribute it and/or modify |
10
|
|
|
* it under the terms of the GNU General Public License as published by |
11
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
12
|
|
|
* (at your option) any later version. |
13
|
|
|
* |
14
|
|
|
* For the full copyright and license information, please read |
15
|
|
|
* LICENSE file that was distributed with this source code. |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use KamiYang\ProjectVersion\Service\ProjectVersion; |
19
|
|
|
use Nimut\TestingFramework\TestCase\UnitTestCase; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class ProjectVersionTest |
23
|
|
|
*/ |
24
|
|
|
class ProjectVersionTest extends UnitTestCase |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @var \KamiYang\ProjectVersion\Service\ProjectVersion |
28
|
|
|
*/ |
29
|
|
|
private $subject; |
30
|
|
|
|
31
|
|
|
protected function setUp() |
32
|
|
|
{ |
33
|
|
|
$this->subject = new ProjectVersion(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @test |
38
|
|
|
*/ |
39
|
|
|
public function getTitleShouldReturnInitialValue() |
40
|
|
|
{ |
41
|
|
|
static::assertSame( |
42
|
|
|
'LLL:EXT:project_version/Resources/Private/Language/Backend.xlf:toolbarItems.sysinfo.project-version', |
43
|
|
|
$this->subject->getTitle() |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @test |
49
|
|
|
*/ |
50
|
|
|
public function setTitleShouldSetPropertyTitle() |
51
|
|
|
{ |
52
|
|
|
$newValue = 'Project Version is awesome!'; |
53
|
|
|
|
54
|
|
|
$this->subject->setTitle($newValue); |
55
|
|
|
|
56
|
|
|
static::assertAttributeSame($newValue, 'title', $this->subject); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @test |
61
|
|
|
*/ |
62
|
|
|
public function initialVersionValueShouldBeLLLString() |
63
|
|
|
{ |
64
|
|
|
static::assertAttributeSame( |
65
|
|
|
'LLL:EXT:project_version/Resources/Private/Language/Backend.xlf:toolbarItems.sysinfo.project-version.unknown', |
66
|
|
|
'version', |
67
|
|
|
$this->subject |
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @test |
73
|
|
|
*/ |
74
|
|
|
public function setVersionShouldSetPropertyVersion() |
75
|
|
|
{ |
76
|
|
|
$newValue = 'Project Version is awesome!'; |
77
|
|
|
|
78
|
|
|
$this->subject->setVersion($newValue); |
79
|
|
|
|
80
|
|
|
static::assertAttributeSame($newValue, 'version', $this->subject); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @test |
85
|
|
|
*/ |
86
|
|
|
public function getIconIdentifierShouldReturnInitialValue() |
87
|
|
|
{ |
88
|
|
|
static::assertSame('information-project-version', $this->subject->getIconIdentifier()); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @test |
93
|
|
|
*/ |
94
|
|
|
public function setIconIdentifierShouldSetPropertyIconIdentifier() |
95
|
|
|
{ |
96
|
|
|
$newValue = 'Project Version is awesome!'; |
97
|
|
|
|
98
|
|
|
$this->subject->setIconIdentifier($newValue); |
99
|
|
|
|
100
|
|
|
static::assertAttributeSame($newValue, 'iconIdentifier', $this->subject); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|