/** * Sets up this testcase */ protected function setUp() { $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array()); $this->backendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::class, array('getTypoScriptSetup')); $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class); $this->backendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService); }
/** * Add a mock standalone view to fixture */ protected function addMockViewToFixture() { $this->standaloneView = $this->getMock('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $this->request = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Request'); $this->standaloneView->expects($this->any())->method('getRequest')->will($this->returnValue($this->request)); $this->fixture->_set('view', $this->standaloneView); }
/** * Sets up this testcase */ public function setUp() { $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array()); $this->backendConfigurationManager = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array('getTypoScriptSetup')); $this->mockTypoScriptService = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $this->backendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService); }
/** * Set up * * @return void */ protected function setUp() { // Mock system under test to make protected methods accessible $this->configurationItemRepository = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ConfigurationItemRepository::class, array('dummy')); $this->injectedObjectManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class, array(), array(), '', FALSE); $this->configurationItemRepository->_set('objectManager', $this->injectedObjectManagerMock); }
/** * Set up */ public function setUp() { parent::setUp(); $this->viewHelper = $this->getAccessibleMock('Tx_MooxNews_ViewHelpers_SimplePrevNextViewHelper', array('dummy')); $mockedDatabaseConnection = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('exec_SELECTgetSingleRow')); $this->viewHelper->_set('databaseConnection', $mockedDatabaseConnection); }
/** * Set up */ public function setUp() { parent::setUp(); $this->viewHelper = $this->getAccessibleMock('GeorgRinger\\News\\ViewHelpers\\SimplePrevNextViewHelper', ['dummy']); $mockedDatabaseConnection = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', ['exec_SELECTgetSingleRow']); $this->viewHelper->_set('databaseConnection', $mockedDatabaseConnection); }
/** * @test */ public function persistSessionTokenWritesTokensToSession() { $_SESSION['installToolFormToken'] = 'foo'; $this->fixture->_set('sessionToken', '881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd'); $this->fixture->persistSessionToken(); $this->assertEquals('881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd', $_SESSION['installToolFormToken']); }
/** * Add a mock standalone view to subject */ protected function addMockViewToSubject() { $this->standaloneView = $this->getMock(\TYPO3\CMS\Fluid\View\StandaloneView::class, array(), array(), '', false); $this->request = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Request::class); $this->standaloneView->expects($this->any())->method('getRequest')->will($this->returnValue($this->request)); $this->subject->_set('view', $this->standaloneView); }
/** * Test for render() * * @param string $validation * @param string $expectedResult * @param bool $nativeValidationEnabled * @return void * @dataProvider renderReturnsStringDataProvider * @test */ public function renderReturnsString($validation, $expectedResult, $nativeValidationEnabled) { $this->abstractValidationViewHelperMock->_set('settings', ['validation' => ['native' => $nativeValidationEnabled ? '1' : '0']]); $field = new Field(); $field->setValidation($validation); $result = $this->abstractValidationViewHelperMock->_callRef('render', $field); $this->assertSame($expectedResult, $result); }
/** * Test for render() * * @param array $settings * @param array $additionalAttributes * @param array $expectedResult * @return void * @dataProvider renderReturnsArrayDataProvider * @test */ public function renderReturnsArray($settings, $additionalAttributes, $expectedResult) { $form = new Form(); $form->_setProperty('uid', 123); $this->enableParsleyAndAjaxViewHelperMock->_set('addRedirectUri', false); $this->enableParsleyAndAjaxViewHelperMock->_set('settings', $settings); $result = $this->enableParsleyAndAjaxViewHelperMock->_callRef('render', $form, $additionalAttributes); $this->assertSame($expectedResult, $result); }
/** * Test for render() * * @param array $settings * @param array $fieldProperties * @param array $additionalAttributes * @param array $expectedResult * @return void * @dataProvider renderReturnsArrayDataProvider * @test */ public function renderReturnsArray($settings, $fieldProperties, $additionalAttributes, $expectedResult) { $field = new Field(); foreach ($fieldProperties as $propertyName => $propertyValue) { $field->_setProperty($propertyName, $propertyValue); } $this->abstractValidationViewHelperMock->_set('settings', $settings); $result = $this->abstractValidationViewHelperMock->_callRef('render', $field, $additionalAttributes); $this->assertSame($expectedResult, $result); }
/** * Test for render() * * @param bool $extensionTableExists * @param bool $isNewerVersionAvailable * @param bool $currentVersionInExtensionTableExists * @param bool $isCurrentVersionUnsecure * @param int $expectedResult * @return void * @dataProvider renderReturnsIntDataProvider * @test */ public function renderReturnsInt($extensionTableExists, $isNewerVersionAvailable, $currentVersionInExtensionTableExists, $isCurrentVersionUnsecure, $expectedResult) { $this->abstractValidationViewHelperMock->_set('checkFromDatabase', false); $this->abstractValidationViewHelperMock->_callRef('setExtensionTableExists', $extensionTableExists); $this->abstractValidationViewHelperMock->_callRef('setIsNewerVersionAvailable', $isNewerVersionAvailable); $this->abstractValidationViewHelperMock->_callRef('setCurrentVersionInExtensionTableExists', $currentVersionInExtensionTableExists); $this->abstractValidationViewHelperMock->_callRef('setIsCurrentVersionUnsecure', $isCurrentVersionUnsecure); $result = $this->abstractValidationViewHelperMock->_callRef('render'); $this->assertSame($expectedResult, $result); }
protected function setUp() { parent::setUp(); // Store all locale categories manipulated in tests for reconstruction in tearDown $this->backupLocales = array('LC_COLLATE' => setlocale(LC_COLLATE, 0), 'LC_CTYPE' => setlocale(LC_CTYPE, 0), 'LC_MONETARY' => setlocale(LC_MONETARY, 0), 'LC_TIME' => setlocale(LC_TIME, 0)); $this->timezone = @date_default_timezone_get(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] = 'Y-m-d'; $this->subject = $this->getAccessibleMock(DateViewHelper::class, array('renderChildren')); /** @var RenderingContext $renderingContext */ $renderingContext = $this->getMock(RenderingContext::class); $this->subject->_set('renderingContext', $renderingContext); }
/** * @test * @expectedException \RuntimeException */ public function updateRootlineDataWithInvalidNewRootlineThrowsException() { $originalRootline = array(0 => array('uid' => 2, 'title' => 'originalTitle'), 1 => array('uid' => 3, 'title' => 'originalTitle2')); $newInvalidRootline = array(0 => array('uid' => 1, 'title' => 'newTitle'), 1 => array('uid' => 2, 'title' => 'newTitle2')); $this->templateServiceMock->_set('rootLine', $originalRootline); $this->templateServiceMock->updateRootlineData($newInvalidRootline); }
/** * Sets up this test case * * @return void */ protected function setUp() { $this->singletonInstances = GeneralUtility::getSingletonInstances(); $this->view = $this->getAccessibleMock(\TYPO3\CMS\Fluid\View\StandaloneView::class, array('testFileExistence', 'buildParserConfiguration'), array(), '', FALSE); $this->mockTemplateParser = $this->getMock(TemplateParser::class); $this->mockParsedTemplate = $this->getMock(\TYPO3\CMS\Fluid\Core\Parser\ParsedTemplateInterface::class); $this->mockTemplateParser->expects($this->any())->method('parse')->will($this->returnValue($this->mockParsedTemplate)); $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class); $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class); $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback'))); $this->mockRequest = $this->getMock(Request::class); $this->mockUriBuilder = $this->getMock(UriBuilder::class); $this->mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $this->mockControllerContext = $this->getMock(ControllerContext::class); $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest)); $this->mockViewHelperVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class); $this->mockRenderingContext = $this->getMock(RenderingContext::class); $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext)); $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer)); $this->view->_set('templateParser', $this->mockTemplateParser); $this->view->_set('objectManager', $this->mockObjectManager); $this->view->setRenderingContext($this->mockRenderingContext); $this->mockTemplateCompiler = $this->getMock(TemplateCompiler::class); $this->view->_set('templateCompiler', $this->mockTemplateCompiler); GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class, $this->mockObjectManager); GeneralUtility::addInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, $this->mockContentObject); $mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array(), array(), '', FALSE); $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(), '', FALSE); $mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache)); GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $mockCacheManager); }
/** * Test for isClientValidationEnabled() * * @param array $settings * @param bool $expectedNativeResult * @param bool $expectedClientResult * @return void * @dataProvider isValidationEnabledReturnsBoolDataProvider * @test */ public function isClientValidationEnabledReturnsBool($settings, $expectedNativeResult, $expectedClientResult) { unset($expectedNativeResult); $this->abstractValidationViewHelperMock->_set('settings', $settings); $result = $this->abstractValidationViewHelperMock->_callRef('isClientValidationEnabled'); $this->assertSame($expectedClientResult, $result); }
/** * Sets up this test case * * @return void */ public function setUp() { $this->singletonInstances = GeneralUtility::getSingletonInstances(); $this->view = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\StandaloneView', array('testFileExistence', 'buildParserConfiguration'), array(), '', FALSE); $this->mockTemplateParser = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser'); $this->mockParsedTemplate = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsedTemplateInterface'); $this->mockTemplateParser->expects($this->any())->method('parse')->will($this->returnValue($this->mockParsedTemplate)); $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback'))); $this->mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request'); $this->mockUriBuilder = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); $this->mockFlashMessageContainer = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\FlashMessageContainer'); $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $this->mockControllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext'); $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest)); $this->mockViewHelperVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer'); $this->mockRenderingContext = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContext'); $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext)); $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer)); $this->view->_set('templateParser', $this->mockTemplateParser); $this->view->_set('objectManager', $this->mockObjectManager); $this->view->setRenderingContext($this->mockRenderingContext); $this->mockTemplateCompiler = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Compiler\\TemplateCompiler'); $this->view->_set('templateCompiler', $this->mockTemplateCompiler); GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', $this->mockObjectManager); GeneralUtility::addInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', $this->mockContentObject); /** @var \TYPO3\CMS\Core\Cache\CacheManager|\PHPUnit_Framework_MockObject_MockObject $mockCacheManager */ $mockCacheManager = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager', array(), array(), '', FALSE); $mockCache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend', array(), array(), '', FALSE); $mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache)); GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager', $mockCacheManager); }
/** * @test */ public function persistSessionTokenWritesTokenToSession() { $sessionToken = $this->getUniqueId('test_'); $this->subject->_set('sessionToken', $sessionToken); $this->getBackendUser()->expects($this->once())->method('setAndSaveSessionData')->with('formSessionToken', $sessionToken); $this->subject->persistSessionToken(); }
/** * Test for render() * * @param array $settings * @param array $fieldProperties * @param array $additionalAttributes * @param mixed $iteration * @param array $expectedResult * @return void * @dataProvider renderReturnsArrayDataProvider * @test */ public function renderReturnsArray($settings, $fieldProperties, $additionalAttributes, $iteration, $expectedResult) { $field = new Field(); foreach ($fieldProperties as $propertyName => $propertyValue) { $field->_setProperty($propertyName, $propertyValue); } $this->abstractValidationViewHelperMock->_set('settings', $settings); $this->abstractValidationViewHelperMock->_set('extensionName', 'powermail'); $controllerContext = new ControllerContext(); $request = new Request(); $request->setControllerExtensionName('powermail'); $controllerContext->setRequest($request); $this->abstractValidationViewHelperMock->_set('controllerContext', $controllerContext); $result = $this->abstractValidationViewHelperMock->_callRef('render', $field, $additionalAttributes, $iteration); $this->assertSame($expectedResult, $result); }
/** * Sets up this test case * * @return void */ protected function setUp() { $this->singletonInstances = GeneralUtility::getSingletonInstances(); $this->view = $this->getAccessibleMock(\TYPO3\CMS\Fluid\View\StandaloneView::class, array('testFileExistence', 'buildParserConfiguration', 'getOrParseAndStoreTemplate'), array(), '', false); $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class); $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class); $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback'))); $this->mockRequest = $this->getMock(Request::class); $this->mockUriBuilder = $this->getMock(UriBuilder::class); $this->mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $this->mockControllerContext = $this->getMock(ControllerContext::class); $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest)); $this->mockTemplatePaths = $this->getMock(TemplatePaths::class); $this->mockViewHelperVariableContainer = $this->getMock(ViewHelperVariableContainer::class); $this->mockRenderingContext = $this->getMock(\TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture::class); $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext)); $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer)); $this->mockRenderingContext->expects($this->any())->method('getVariableProvider')->willReturn($this->mockVariableProvider); $this->mockRenderingContext->expects($this->any())->method('getTemplatePaths')->willReturn($this->mockTemplatePaths); $this->view->_set('objectManager', $this->mockObjectManager); $this->view->_set('baseRenderingContext', $this->mockRenderingContext); $this->view->_set('controllerContext', $this->mockControllerContext); $this->view->expects($this->any())->method('getOrParseAndStoreTemplate')->willReturn($this->mockParsedTemplate); GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class, $this->mockObjectManager); GeneralUtility::addInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, $this->mockContentObject); $this->mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array(), array(), '', false); $mockCache = $this->getMock(\TYPO3Fluid\Fluid\Core\Cache\FluidCacheInterface::class, array(), array(), '', false); $this->mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache)); GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $this->mockCacheManager); }
/** * @test */ public function settingRequestAdminPropertySetsAdminRoleInUserAuthentication() { $mockedUserAuthentication = $this->getMock(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class); $mockedUserAuthentication->user['admin'] = 42; $this->commandController->expects($this->once())->method('dummyCommand')->will($this->returnCallback(function () use($mockedUserAuthentication) { if ($mockedUserAuthentication->user['admin'] !== 1) { throw new \Exception('User role is not admin'); } })); $this->commandController->_set('userAuthentication', $mockedUserAuthentication); $this->commandController->_set('arguments', array()); $this->commandController->_set('commandMethodName', 'dummyCommand'); $this->commandController->_set('requestAdminPermissions', TRUE); $this->commandController->_call('callCommandMethod'); $this->assertSame(42, $mockedUserAuthentication->user['admin']); }
/** * @test */ public function getAdditionalInformationRespectsArguments() { $this->task->_set('commandIdentifier', 'foo'); $this->task->_set('defaults', array('bar' => 'baz')); $this->task->_set('arguments', array('qux' => 'quux')); $this->assertSame('foo qux=quux', $this->task->getAdditionalInformation()); }
/** * @test * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException */ public function dispatchThrowsInvalidSlotExceptionIfObjectManagerOfSignalSlotDispatcherIsNotSet() { $this->signalSlotDispatcher->_set('isInitialized', true); $this->signalSlotDispatcher->_set('objectManager', null); $this->signalSlotDispatcher->_set('slots', array('ClassA' => array('emitSomeSignal' => array(array())))); $this->assertSame(null, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal')); }
/** * @test */ public function installCallsSaveDefaultConfigurationWithExtensionKey() { $cacheManagerMock = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cacheManagerMock->expects($this->once())->method('flushCachesInGroup'); $this->installMock->_set('cacheManager', $cacheManagerMock); $this->installMock->expects($this->once())->method('saveDefaultConfiguration')->with('dummy'); $this->installMock->install('dummy'); }
/** * @test * @return void */ public function getOverrideDemandSettingsAddsValueIfFilled() { $flexform = []; $this->addContentToFlexform($flexform, 'settings.disableOverrideDemand', '1', 'additional'); $this->pageLayoutView->_set('flexformData', $flexform); $this->pageLayoutView->_call('getOverrideDemandSettings'); $this->assertEquals(count($this->pageLayoutView->_get('tableData')), 1); }
/** * @test */ public function standardTagAttributesAreRegistered() { $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('addAttribute'), array(), '', FALSE); $mockTagBuilder->expects($this->at(0))->method('addAttribute')->with('class', 'classAttribute'); $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('dir', 'dirAttribute'); $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('id', 'idAttribute'); $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('lang', 'langAttribute'); $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('style', 'styleAttribute'); $mockTagBuilder->expects($this->at(5))->method('addAttribute')->with('title', 'titleAttribute'); $mockTagBuilder->expects($this->at(6))->method('addAttribute')->with('accesskey', 'accesskeyAttribute'); $mockTagBuilder->expects($this->at(7))->method('addAttribute')->with('tabindex', 'tabindexAttribute'); $this->viewHelper->_set('tag', $mockTagBuilder); $arguments = array('class' => 'classAttribute', 'dir' => 'dirAttribute', 'id' => 'idAttribute', 'lang' => 'langAttribute', 'style' => 'styleAttribute', 'title' => 'titleAttribute', 'accesskey' => 'accesskeyAttribute', 'tabindex' => 'tabindexAttribute'); $this->viewHelper->_call('registerUniversalTagAttributes'); $this->viewHelper->setArguments($arguments); $this->viewHelper->initializeArguments(); $this->viewHelper->initialize(); }
/** * @test */ public function processRedirectReferrerDomainsMatchesDomains() { $conf = array('redirectMode' => 'refererDomains', 'domains' => 'example.com'); $this->accessibleFixture->_set('conf', $conf); $this->accessibleFixture->_set('logintype', 'login'); $this->accessibleFixture->_set('referer', 'http://www.example.com/snafu'); $GLOBALS['TSFE']->loginUser = TRUE; $this->assertSame(array('http://www.example.com/snafu'), $this->accessibleFixture->_call('processRedirect')); }
/** * @test */ public function processAjaxRequestUnzipProcessActuallyDoesNotChangeFileData() { $this->fileController = $this->getAccessibleMock(\TYPO3\CMS\Backend\Controller\File\FileController::class, array('init', 'main')); $fileData = array('unzip' => array(true)); $this->fileController->_set('fileProcessor', $this->mockFileProcessor); $this->fileController->_set('fileData', $fileData); $this->fileController->_set('redirect', false); $this->fileController->expects($this->once())->method('main'); $this->fileController->processAjaxRequest($this->request, $this->response); }
/** * @test */ public function buildSetsDefaultActionNameIfSpecifiedActionIsNotAllowedAndCallDefaultActionIfActionCantBeResolvedIsSet() { $this->configuration['mvc']['callDefaultActionIfActionCantBeResolved'] = 1; $this->injectDependencies(); $this->requestBuilder->_set('extensionService', $this->mockExtensionService); $_GET = array('tx_myextension_pi1' => array('controller' => 'TheThirdController', 'action' => 'someInvalidAction')); $this->mockRequest->expects($this->once())->method('setControllerName')->with('TheThirdController'); $this->mockRequest->expects($this->once())->method('setControllerActionName')->with('delete'); $this->requestBuilder->build(); }
/** * @test */ public function overrideConfigurationFromFlexFormChecksForDataIsArrayAndEmpty() { /** @var $flexFormService \TYPO3\CMS\Extbase\Service\FlexFormService|\PHPUnit_Framework_MockObject_MockObject */ $flexFormService = $this->getMock('TYPO3\\CMS\\Extbase\\Service\\FlexFormService', array('convertFlexFormContentToArray')); $flexFormService->expects($this->never())->method('convertFlexFormContentToArray'); $this->frontendConfigurationManager->_set('flexFormService', $flexFormService); $this->mockContentObject->data = array('pi_flexform' => array()); $frameworkConfiguration = array('persistence' => array('storagePid' => '98')); $this->assertSame(array('persistence' => array('storagePid' => '98')), $this->frontendConfigurationManager->_call('overrideConfigurationFromFlexForm', $frameworkConfiguration)); }