Example #1
0
 /**
  * Tests Tx_Asdis_Domain_Repository_ServerRepository->findAll()
  * @test
  */
 public function findAllByPage()
 {
     $objectManager = $this->getMock('\\TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
     $objectManager->expects($this->any())->method('get')->will($this->returnValue($this->getMock('Tx_Asdis_Domain_Model_Server_Collection')));
     $this->serverRepository->injectObjectManager($objectManager);
     $page = new Tx_Asdis_Domain_Model_Page();
     $server = array();
     $server['identifier'] = uniqid();
     $server['domain'] = 'example.com';
     $servers = array($server);
     $config = $this->getMock('Tx_Asdis_System_Configuration_Provider');
     $config->expects($this->any())->method('getServerDefinitions')->will($this->returnValue($servers));
     $this->serverRepository->injectConfigurationProvider($config);
     $factory = $this->getMock('Tx_Asdis_Domain_Model_Server_Factory');
     $factory->expects($this->once())->method('createServer')->will($this->returnValue($this->getMock('Tx_Asdis_Domain_Model_Server')));
     $this->serverRepository->injectServerFactory($factory);
     $test = $this->serverRepository->findAllByPage($page);
     $this->assertTrue($test instanceof Tx_Asdis_Domain_Model_Server_Collection);
 }
Example #2
0
 /**
  * Replaces the assets of the page.
  * To force any replacement, you have to call "scrapeAssets" before.
  *
  * @return void
  */
 public function replaceAssets()
 {
     if (FALSE === $this->configurationProvider->isReplacementEnabled()) {
         return;
     }
     $distributionAlgorithmKey = '';
     try {
         $distributionAlgorithmKey = $this->configurationProvider->getDistributionAlgorithmKey();
     } catch (Exception $e) {
     }
     $distributionAlgorithm = $this->distributionAlgorithmFactory->buildDistributionAlgorithmFromKey($distributionAlgorithmKey);
     $distributionAlgorithm->distribute($this->getAssets(), $this->serverRepository->findAllByPage($this));
     $this->pageObject->content = $this->replacementProcessor->replace($this->assets->getReplacementMap(), $this->pageObject->content);
 }
Example #3
0
 /**
  * @return Tx_Asdis_Domain_Model_Server_Collection
  */
 private function getServers()
 {
     $servers = $this->serverRepository->findAllByPage($this->page);
     $this->forceSSL($servers);
     return $servers;
 }