|
@@ 73-90 (lines=18) @@
|
| 70 |
|
* @test |
| 71 |
|
* @return void |
| 72 |
|
*/ |
| 73 |
|
public function getAdditionalCssReturnsMarginTopIfBannerHasMarginTopTest() |
| 74 |
|
{ |
| 75 |
|
$bannerUid = 100; |
| 76 |
|
$banner = $this->getMockBuilder(Banner::class)->getMock(); |
| 77 |
|
$banner->expects($this->any())->method('getMarginTop')->will($this->returnValue(10)); |
| 78 |
|
$banner->expects($this->any())->method('getMarginRight')->will($this->returnValue(0)); |
| 79 |
|
$banner->expects($this->any())->method('getMarginBottom')->will($this->returnValue(0)); |
| 80 |
|
$banner->expects($this->any())->method('getMarginLeft')->will($this->returnValue(0)); |
| 81 |
|
$banner->expects($this->once())->method('getUid')->will($this->returnValue($bannerUid)); |
| 82 |
|
|
| 83 |
|
/** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $banners */ |
| 84 |
|
$banners = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
| 85 |
|
$banners->attach($banner); |
| 86 |
|
|
| 87 |
|
$expected = '.banner-' . $bannerUid . ' { margin: 10px 0px 0px 0px; }' . chr(10) . chr(13); |
| 88 |
|
$result = $this->bannerService->getAdditionalCss($banners); |
| 89 |
|
$this->assertEquals($expected, $result); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
/** |
| 93 |
|
* Test if additional css returns correct right margin |
|
@@ 98-115 (lines=18) @@
|
| 95 |
|
* @test |
| 96 |
|
* @return void |
| 97 |
|
*/ |
| 98 |
|
public function getAdditionalCssReturnsMarginRightIfBannerHasMarginRightTest() |
| 99 |
|
{ |
| 100 |
|
$bannerUid = 100; |
| 101 |
|
$banner = $this->getMockBuilder(Banner::class)->getMock(); |
| 102 |
|
$banner->expects($this->any())->method('getMarginTop')->will($this->returnValue(0)); |
| 103 |
|
$banner->expects($this->any())->method('getMarginRight')->will($this->returnValue(10)); |
| 104 |
|
$banner->expects($this->any())->method('getMarginBottom')->will($this->returnValue(0)); |
| 105 |
|
$banner->expects($this->any())->method('getMarginLeft')->will($this->returnValue(0)); |
| 106 |
|
$banner->expects($this->once())->method('getUid')->will($this->returnValue($bannerUid)); |
| 107 |
|
|
| 108 |
|
/** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $banners */ |
| 109 |
|
$banners = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
| 110 |
|
$banners->attach($banner); |
| 111 |
|
|
| 112 |
|
$expected = '.banner-' . $bannerUid . ' { margin: 0px 10px 0px 0px; }' . chr(10) . chr(13); |
| 113 |
|
$result = $this->bannerService->getAdditionalCss($banners); |
| 114 |
|
$this->assertEquals($expected, $result); |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
/** |
| 118 |
|
* Test if additional css returns correct bottom margin |
|
@@ 123-140 (lines=18) @@
|
| 120 |
|
* @test |
| 121 |
|
* @return void |
| 122 |
|
*/ |
| 123 |
|
public function getAdditionalCssReturnsMarginBottomIfBannerHasMarginBottomTest() |
| 124 |
|
{ |
| 125 |
|
$bannerUid = 100; |
| 126 |
|
$banner = $this->getMockBuilder(Banner::class)->getMock(); |
| 127 |
|
$banner->expects($this->any())->method('getMarginTop')->will($this->returnValue(0)); |
| 128 |
|
$banner->expects($this->any())->method('getMarginRight')->will($this->returnValue(0)); |
| 129 |
|
$banner->expects($this->any())->method('getMarginBottom')->will($this->returnValue(10)); |
| 130 |
|
$banner->expects($this->any())->method('getMarginLeft')->will($this->returnValue(0)); |
| 131 |
|
$banner->expects($this->once())->method('getUid')->will($this->returnValue($bannerUid)); |
| 132 |
|
|
| 133 |
|
/** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $banners */ |
| 134 |
|
$banners = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
| 135 |
|
$banners->attach($banner); |
| 136 |
|
|
| 137 |
|
$expected = '.banner-' . $bannerUid . ' { margin: 0px 0px 10px 0px; }' . chr(10) . chr(13); |
| 138 |
|
$result = $this->bannerService->getAdditionalCss($banners); |
| 139 |
|
$this->assertEquals($expected, $result); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* Test if additional css returns correct left margin |
|
@@ 148-165 (lines=18) @@
|
| 145 |
|
* @test |
| 146 |
|
* @return void |
| 147 |
|
*/ |
| 148 |
|
public function getAdditionalCssReturnsMarginLeftIfBannerHasMarginLeftTest() |
| 149 |
|
{ |
| 150 |
|
$bannerUid = 100; |
| 151 |
|
$banner = $this->getMockBuilder(Banner::class)->getMock(); |
| 152 |
|
$banner->expects($this->any())->method('getMarginTop')->will($this->returnValue(0)); |
| 153 |
|
$banner->expects($this->any())->method('getMarginRight')->will($this->returnValue(0)); |
| 154 |
|
$banner->expects($this->any())->method('getMarginBottom')->will($this->returnValue(0)); |
| 155 |
|
$banner->expects($this->any())->method('getMarginLeft')->will($this->returnValue(10)); |
| 156 |
|
$banner->expects($this->once())->method('getUid')->will($this->returnValue($bannerUid)); |
| 157 |
|
|
| 158 |
|
/** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $banners */ |
| 159 |
|
$banners = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
| 160 |
|
$banners->attach($banner); |
| 161 |
|
|
| 162 |
|
$expected = '.banner-' . $bannerUid . ' { margin: 0px 0px 0px 10px; }' . chr(10) . chr(13); |
| 163 |
|
$result = $this->bannerService->getAdditionalCss($banners); |
| 164 |
|
$this->assertEquals($expected, $result); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
/** |
| 168 |
|
* Test if additional css returns correct margins for multiple banners |