コード例 #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);
 }