Ejemplo n.º 1
0
 /**
  * Test if additional css returns correct margins for multiple banners
  *
  * @test
  * @return void
  */
 public function getAdditionalCssReturnsCssForMultipleBannersTest()
 {
     $bannerUid1 = 100;
     $bannerUid2 = 200;
     $banner1 = $this->getMock('DERHANSEN\\SfBanners\\Domain\\Model\\Banner', array(), array(), '', false);
     $banner1->expects($this->any())->method('getMarginTop')->will($this->returnValue(0));
     $banner1->expects($this->any())->method('getMarginRight')->will($this->returnValue(10));
     $banner1->expects($this->any())->method('getMarginBottom')->will($this->returnValue(0));
     $banner1->expects($this->any())->method('getMarginLeft')->will($this->returnValue(10));
     $banner1->expects($this->once())->method('getUid')->will($this->returnValue($bannerUid1));
     $banner2 = $this->getMock('DERHANSEN\\SfBanners\\Domain\\Model\\Banner', array(), array(), '', false);
     $banner2->expects($this->any())->method('getMarginTop')->will($this->returnValue(10));
     $banner2->expects($this->any())->method('getMarginRight')->will($this->returnValue(0));
     $banner2->expects($this->any())->method('getMarginBottom')->will($this->returnValue(10));
     $banner2->expects($this->any())->method('getMarginLeft')->will($this->returnValue(0));
     $banner2->expects($this->once())->method('getUid')->will($this->returnValue($bannerUid2));
     /** @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage $banners */
     $banners = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $banners->attach($banner1);
     $banners->attach($banner2);
     $expected = '.banner-' . $bannerUid1 . ' { margin: 0px 10px 0px 10px; }' . chr(10) . chr(13);
     $expected .= '.banner-' . $bannerUid2 . ' { margin: 10px 0px 10px 0px; }' . chr(10) . chr(13);
     $result = $this->bannerService->getAdditionalCss($banners);
     $this->assertEquals($expected, $result);
 }
Ejemplo n.º 2
0
 /**
  * Test if additional css returns correct margins for multiple banners
  *
  * @test
  * @return void
  */
 public function getAdditionalCssReturnsCssForMultipleBannersTest()
 {
     $pid = 111;
     $bannerUid1 = $this->testingFramework->createRecord('tx_sfbanners_domain_model_banner', array('pid' => $pid, 'margin_left' => 10, 'margin_right' => 10, 'sorting' => 1));
     $bannerUid2 = $this->testingFramework->createRecord('tx_sfbanners_domain_model_banner', array('pid' => $pid, 'margin_top' => 10, 'margin_bottom' => 10, 'sorting' => 2));
     /* Get banner from Repository */
     $this->demand->setStartingPoint($pid);
     $banners = $this->bannerRepository->findDemanded($this->demand);
     $expected = '.banner-' . $bannerUid1 . ' { margin: 0px 10px 0px 10px; }' . chr(10) . chr(13);
     $expected .= '.banner-' . $bannerUid2 . ' { margin: 10px 0px 10px 0px; }' . chr(10) . chr(13);
     $result = $this->bannerService->getAdditionalCss($banners);
     $this->assertEquals($expected, $result);
 }