/** * @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); }