/**
  * @test
  */
 public function executeCallsUpdateExtListOfRepositoryHelper()
 {
     $this->repositoryHelper->expects($this->once())->method('updateExtList');
     $objectManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
     $objectManagerMock->expects($this->at(0))->method('get')->with(\TYPO3\CMS\Extensionmanager\Utility\Repository\Helper::class)->will($this->returnValue($this->repositoryHelper));
     $persistenceManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
     $objectManagerMock->expects($this->at(1))->method('get')->will($this->returnValue($persistenceManagerMock));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class, $objectManagerMock);
     $task = $this->getMock(\TYPO3\CMS\Extensionmanager\Task\UpdateExtensionListTask::class, array('dummy'), array(), '', FALSE);
     $task->execute();
 }
Ejemplo n.º 2
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);
 }