Example #1
0
 /**
  * Test if no CSS link is returned if no banners given
  *
  * @test
  * @return void
  */
 public function getAdditionalCssLinkReturnsLinkTest()
 {
     $pid = 115;
     $this->testingFramework->createRecord('tx_sfbanners_domain_model_banner', array('pid' => $pid, 'margin_left' => 10, 'margin_right' => 10, 'sorting' => 1));
     /* Get banner from Repository */
     $this->demand->setStartingPoint($pid);
     $banners = $this->bannerRepository->findDemanded($this->demand);
     $result = $this->bannerService->getAdditionalCssLink($banners);
     $this->assertContains('<link rel="stylesheet" type="text/css" href=', $result);
     $this->assertContains('typo3temp/stylesheet_', $result);
     $this->assertContains('.css', $result);
     $this->assertContains('media="all" />', $result);
 }
Example #2
0
 /**
  * Test if the current page uid can be set
  *
  * @test
  * @return void
  */
 public function currentPageUidCanBeSetTest()
 {
     $currentPageUid = 99;
     $this->fixture->setCurrentPageUid($currentPageUid);
     $this->assertEquals($currentPageUid, $this->fixture->getCurrentPageUid());
 }
Example #3
0
 /**
  * Returns all banners in respect to excludepages (recursively if set in banner)
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface $result The result
  * @param \DERHANSEN\SfBanners\Domain\Model\BannerDemand $demand The demand
  * @return array
  */
 protected function getExcludePageBanners(QueryResultInterface $result, BannerDemand $demand)
 {
     /** @var \TYPO3\CMS\Core\Database\QueryGenerator $queryGenerator */
     $queryGenerator = $this->objectManager->get('TYPO3\\CMS\\Core\\Database\\QueryGenerator');
     $banners = array();
     /** @var \DERHANSEN\SfBanners\Domain\Model\Banner $banner */
     foreach ($result as $banner) {
         $excludePages = array();
         foreach ($banner->getExcludepages() as $excludePage) {
             if ($banner->getRecursive()) {
                 $pidList = $queryGenerator->getTreeList($excludePage->getUid(), 255, 0, 1);
                 $excludePages = array_merge($excludePages, explode(',', $pidList));
             } else {
                 $excludePages[] = $excludePage->getUid();
             }
         }
         if (!in_array($demand->getCurrentPageUid(), $excludePages)) {
             $banners[] = $banner;
         }
     }
     return $banners;
 }
 /**
  * Set up
  *
  * @return void
  */
 public function setUp()
 {
     $this->bannerService = new BannerService();
     $this->demand = new BannerDemand();
     $this->demand->setDisplayMode('all');
 }