/**
  * @test
  */
 public function findOneTypo3OrgRepositoryReturnsRepositoryWithCorrectTitle()
 {
     $mockModelOne = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
     $mockModelOne->expects($this->once())->method('getTitle')->will($this->returnValue('foo'));
     $mockModelTwo = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
     $mockModelTwo->expects($this->once())->method('getTitle')->will($this->returnValue('TYPO3.org Main Repository'));
     $this->fixture->expects($this->once())->method('findAll')->will($this->returnValue(array($mockModelOne, $mockModelTwo)));
     $this->assertSame($mockModelTwo, $this->fixture->findOneTypo3OrgRepository());
 }
 /**
  * @test
  */
 public function getMainRepositoryStatusReturnsOkIfUpdatedLessThanSevenDaysAgo()
 {
     /** @var $mockRepositoryRepository \TYPO3\CMS\Extensionmanager\Domain\Model\Repository|\PHPUnit_Framework_MockObject_MockObject */
     $mockRepository = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Repository');
     $mockRepository->expects($this->once())->method('getLastUpdate')->will($this->returnValue(new \DateTime('-6 days')));
     $this->mockRepositoryRepository->expects($this->once())->method('findOneTypo3OrgRepository')->will($this->returnValue($mockRepository));
     /** @var $mockReport \TYPO3\CMS\Extensionmanager\Report\ExtensionStatus|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
     $mockReport = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Report\\ExtensionStatus', array('dummy'), array(), '', FALSE);
     $mockReport->_set('objectManager', $this->mockObjectManager);
     $statusMock = $this->getMock('TYPO3\\CMS\\Reports\\Status', array(), array(), '', FALSE);
     $this->mockObjectManager->expects($this->once())->method('get')->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), \TYPO3\CMS\Reports\Status::OK)->will($this->returnValue($statusMock));
     $mockReport->_set('repositoryRepository', $this->mockRepositoryRepository);
     $mockReport->_set('languageService', $this->mockLanguageService);
     /** @var $result \TYPO3\CMS\Reports\Status */
     $result = $mockReport->_call('getMainRepositoryStatus');
     $this->assertSame($statusMock, $result);
 }
Beispiel #3
0
	/**
	 * @test
	 * @return void
	 */
	public function updateExtensionListFromTerCallsUpdateExtListIfForceUpdateCheckIsSet() {
		$controllerMock = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Controller\UpdateFromTerController::class, array('dummy'));
		$repositoryModelMock = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Repository::class, array('getLastUpdate'));
		$viewMock = $this->getAccessibleMock(\TYPO3\CMS\Fluid\View\TemplateView::class, array('assign'), array(), '', FALSE);
		$requestMock = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Request::class, array('hasArgument', 'getArgument'));
		$viewMock->expects($this->any())->method('assign')->will($this->returnValue($viewMock));
		$this->repositoryRepositoryMock->expects($this->once())->method('findByUid')->with(1)->will($this->returnValue($repositoryModelMock));
		$this->repositoryHelperMock->expects($this->once())->method('updateExtList');
		$this->extensionRepositoryMock->expects($this->once())->method('countAll')->will($this->returnValue(100));
		$controllerMock->_set('extensionRepository', $this->extensionRepositoryMock);
		$controllerMock->_set('repositoryRepository', $this->repositoryRepositoryMock);
		$controllerMock->_set('repositoryHelper', $this->repositoryHelperMock);
		$controllerMock->_set('settings', array('repositoryUid' => 1));
		$controllerMock->_set('view', $viewMock);
		$controllerMock->_set('request', $requestMock);
		$controllerMock->updateExtensionListFromTerAction(TRUE);
	}
 /**
  * @test
  * @return void
  */
 public function updateExtensionListFromTerCallsUpdateExtListIfForceUpdateCheckIsSet()
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|AccessibleObjectInterface|UpdateFromTerController $controllerMock */
     $controllerMock = $this->getAccessibleMock(UpdateFromTerController::class, array('getLanguageService'));
     $controllerMock->expects($this->any())->method('getLanguageService')->will($this->returnValue($this->languageServiceMock));
     $repositoryModelMock = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Repository::class, array('getLastUpdate'));
     $viewMock = $this->getAccessibleMock(\TYPO3\CMS\Fluid\View\TemplateView::class, array('assign'), array(), '', false);
     $requestMock = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Request::class, array('hasArgument', 'getArgument'));
     $viewMock->expects($this->any())->method('assign')->will($this->returnValue($viewMock));
     $this->repositoryRepositoryMock->expects($this->once())->method('findByUid')->with(1)->will($this->returnValue($repositoryModelMock));
     $this->repositoryHelperMock->expects($this->once())->method('updateExtList');
     $this->extensionRepositoryMock->expects($this->once())->method('countAll')->will($this->returnValue(100));
     $controllerMock->_set('extensionRepository', $this->extensionRepositoryMock);
     $controllerMock->_set('repositoryRepository', $this->repositoryRepositoryMock);
     $controllerMock->_set('repositoryHelper', $this->repositoryHelperMock);
     $controllerMock->_set('settings', array('repositoryUid' => 1));
     $controllerMock->_set('view', $viewMock);
     $controllerMock->_set('request', $requestMock);
     $controllerMock->updateExtensionListFromTerAction(true);
 }