|
1
|
|
|
<?php |
|
2
|
|
|
namespace DERHANSEN\SfBanners\Test\Unit\Domain\Model; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the Extension "sf_banners" for TYPO3 CMS. |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please read the |
|
8
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
use DERHANSEN\SfBanners\Domain\Model\BannerDemand; |
|
12
|
|
|
use Nimut\TestingFramework\TestCase\UnitTestCase; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Test case for class \DERHANSEN\SfBanners\Domain\Model\BannerDemand. |
|
16
|
|
|
*/ |
|
17
|
|
|
class BannerDemandTest extends UnitTestCase |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* @var \DERHANSEN\SfBanners\Domain\Model\BannerDemand |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $fixture; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Set up |
|
26
|
|
|
* |
|
27
|
|
|
* @return void |
|
28
|
|
|
*/ |
|
29
|
|
|
public function setUp() |
|
30
|
|
|
{ |
|
31
|
|
|
$this->fixture = new BannerDemand(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Tear down |
|
36
|
|
|
* |
|
37
|
|
|
* @return void |
|
38
|
|
|
*/ |
|
39
|
|
|
public function tearDown() |
|
40
|
|
|
{ |
|
41
|
|
|
unset($this->fixture); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Test if categories can be set |
|
46
|
|
|
* |
|
47
|
|
|
* @test |
|
48
|
|
|
* @return void |
|
49
|
|
|
*/ |
|
50
|
|
|
public function categoriesCanBeSetTest() |
|
51
|
|
|
{ |
|
52
|
|
|
$categories = '1,2,3,4'; |
|
53
|
|
|
$this->fixture->setCategories($categories); |
|
54
|
|
|
$this->assertEquals($categories, $this->fixture->getCategories()); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Test if startingpoint can be set |
|
59
|
|
|
* |
|
60
|
|
|
* @test |
|
61
|
|
|
* @return void |
|
62
|
|
|
*/ |
|
63
|
|
|
public function startingPointCanBeSetTest() |
|
64
|
|
|
{ |
|
65
|
|
|
$startingPoint = 1; |
|
66
|
|
|
$this->fixture->setStartingPoint($startingPoint); |
|
67
|
|
|
$this->assertEquals($startingPoint, $this->fixture->getStartingPoint()); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Test if displaymode returns the correct initial value |
|
72
|
|
|
* |
|
73
|
|
|
* @test |
|
74
|
|
|
* @return void |
|
75
|
|
|
*/ |
|
76
|
|
|
public function displayModeReturnsInitialValueForDisplayModeTest() |
|
77
|
|
|
{ |
|
78
|
|
|
$this->assertEquals('all', $this->fixture->getDisplayMode()); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Test if displaymode can be set |
|
83
|
|
|
* |
|
84
|
|
|
* @test |
|
85
|
|
|
* @return void |
|
86
|
|
|
*/ |
|
87
|
|
|
public function displayModeCanBeSetTest() |
|
88
|
|
|
{ |
|
89
|
|
|
$displayMode = 'allRandom'; |
|
90
|
|
|
$this->fixture->setDisplayMode($displayMode); |
|
91
|
|
|
$this->assertEquals($displayMode, $this->fixture->getDisplayMode()); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Test if the current page uid can be set |
|
96
|
|
|
* |
|
97
|
|
|
* @test |
|
98
|
|
|
* @return void |
|
99
|
|
|
*/ |
|
100
|
|
|
public function currentPageUidCanBeSetTest() |
|
101
|
|
|
{ |
|
102
|
|
|
$currentPageUid = 99; |
|
103
|
|
|
$this->fixture->setCurrentPageUid($currentPageUid); |
|
104
|
|
|
$this->assertEquals($currentPageUid, $this->fixture->getCurrentPageUid()); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @test |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getMaxResultsReturnsInitialValue() |
|
111
|
|
|
{ |
|
112
|
|
|
$this->assertEquals(0, $this->fixture->getMaxResults()); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @test |
|
117
|
|
|
*/ |
|
118
|
|
|
public function maxResultsCanBeSet() |
|
119
|
|
|
{ |
|
120
|
|
|
$this->fixture->setMaxResults(10); |
|
121
|
|
|
$this->assertEquals(10, $this->fixture->getMaxResults()); |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
|