/**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * @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);
 }
 /**
  * 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);
 }
 /**
  * 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
  */
 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 processReenablesEscapingInterceptorOnClosingViewHelperTagIfItWasDisabledBefore()
 {
     $interceptorPosition = InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER;
     $this->mockViewHelper->expects($this->any())->method('isOutputEscapingEnabled')->will($this->returnValue(false));
     $this->mockNode->expects($this->any())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper));
     $this->escapeInterceptor->_set('childrenEscapingEnabled', false);
     $this->escapeInterceptor->_set('viewHelperNodesWhichDisableTheInterceptor', array($this->mockNode));
     $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState);
     $this->assertTrue($this->escapeInterceptor->_get('childrenEscapingEnabled'));
 }
Example #10
0
 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
  */
 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 persistSessionTokenWritesTokenToSession()
 {
     $sessionToken = $this->getUniqueId('test_');
     $this->subject->_set('sessionToken', $sessionToken);
     $this->getBackendUser()->expects($this->once())->method('setAndSaveSessionData')->with('formSessionToken', $sessionToken);
     $this->subject->persistSessionToken();
 }
Example #13
0
 /**
  * @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'));
 }
Example #14
0
 /**
  * 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);
 }
 /**
  * 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);
 }
Example #16
0
 /**
  * @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 \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', '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 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
  */
 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();
 }
 /**
  * @param array $accessRoles
  * @param boolean $expectedResult
  * @test
  * @dataProvider hasAccessRestrictionsDataProvider
  */
 public function hasAccessRestrictionsTests($accessRoles, $expectedResult)
 {
     $this->nodeData->_set('accessRoles', $accessRoles);
     if ($expectedResult === true) {
         $this->assertTrue($this->nodeData->hasAccessRestrictions());
     } else {
         $this->assertFalse($this->nodeData->hasAccessRestrictions());
     }
 }
Example #22
0
 /**
  * @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));
 }
 /**
  * @test
  * @param string $linkText
  * @param array $configuration
  * @param string $expectedResult
  * @dataProvider typolinkReturnsCorrectLinksFilesDataProvider
  */
 public function typolinkReturnsCorrectLinksFiles($linkText, $configuration, $expectedResult)
 {
     $templateServiceObjectMock = $this->getMock(TemplateService::class, array('dummy'));
     $templateServiceObjectMock->setup = array('lib.' => array('parseFunc.' => $this->getLibParseFunc()));
     $typoScriptFrontendControllerMockObject = $this->getMock(TypoScriptFrontendController::class, array(), array(), '', false);
     $typoScriptFrontendControllerMockObject->config = array('config' => array(), 'mainScript' => 'index.php');
     $typoScriptFrontendControllerMockObject->tmpl = $templateServiceObjectMock;
     $GLOBALS['TSFE'] = $typoScriptFrontendControllerMockObject;
     $this->subject->_set('typoScriptFrontendController', $typoScriptFrontendControllerMockObject);
     $this->assertEquals($expectedResult, $this->subject->typoLink($linkText, $configuration));
 }
 /**
  * @test
  */
 public function getConfigurationStoresResultInConfigurationCache()
 {
     $this->abstractConfigurationManager->_set('extensionName', 'CurrentExtensionName');
     $this->abstractConfigurationManager->_set('pluginName', 'CurrentPluginName');
     $this->abstractConfigurationManager->expects($this->any())->method('getPluginConfiguration')->will($this->returnValue(array('foo' => 'bar')));
     $this->abstractConfigurationManager->getConfiguration();
     $this->abstractConfigurationManager->getConfiguration('SomeOtherExtensionName', 'SomeOtherCurrentPluginName');
     $expectedResult = array('currentextensionname_currentpluginname', 'someotherextensionname_someothercurrentpluginname');
     $actualResult = array_keys($this->abstractConfigurationManager->_get('configurationCache'));
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * @test
  */
 public function getRecordArrayFetchesTranslationWhenLanguageIdIsSet()
 {
     $pageData = array('uid' => 1, 'title' => 'Original');
     $pageDataTranslated = array('uid' => 1, 'title' => 'Translated', '_PAGES_OVERLAY_UID' => '2');
     $this->subject->expects($this->any())->method('enrichWithRelationFields')->with(2, $pageDataTranslated)->will($this->returnArgument(1));
     $databaseConnectionMock = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
     $databaseConnectionMock->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnValue($pageData));
     $this->subject->_set('databaseConnection', $databaseConnectionMock);
     $this->pageContextMock->expects($this->any())->method('getPageOverlay')->will($this->returnValue($pageDataTranslated));
     $this->subject->_set('languageUid', 1);
     $this->assertSame($pageDataTranslated, $this->subject->_call('getRecordArray', 1));
 }
 /**
  * @test
  * @return void
  */
 public function removeExtensionFromQueueRemovesExtension()
 {
     $extensionMock2 = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension::class, array('dummy'));
     $extensionMock2->_set('extensionKey', 'foobarbaz');
     $extensionMock2->_set('version', '1.0.3');
     $this->downloadQueueMock->_set('extensionStorage', array('download' => array('foobar' => $this->extensionMock, 'foobarbaz' => $extensionMock2)));
     $extensionStorageBefore = $this->downloadQueueMock->_get('extensionStorage');
     $this->assertTrue(array_key_exists('foobar', $extensionStorageBefore['download']));
     $this->downloadQueueMock->removeExtensionFromQueue($this->extensionMock);
     $extensionStorageAfter = $this->downloadQueueMock->_get('extensionStorage');
     $this->assertFalse(array_key_exists('foobar', $extensionStorageAfter['download']));
 }
Example #28
0
 /**
  * @test
  */
 public function buildTypolinkConfigurationResolvesDefaultPageTypeFromFormatIfFormatIsNotMapped()
 {
     $this->uriBuilder->setTargetPageUid(123);
     $this->uriBuilder->setFormat('txt');
     $mockConfigurationManager = $this->getMock(ConfigurationManager::class);
     $mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue(array(array('view' => array('formatToPageTypeMapping' => array('pdf' => 2))))));
     $this->uriBuilder->_set('configurationManager', $mockConfigurationManager);
     $this->mockExtensionService->expects($this->any())->method('getTargetPageTypeByFormat')->with(null, 'txt')->will($this->returnValue(0));
     $expectedConfiguration = array('parameter' => '123,0', 'useCacheHash' => 1);
     $actualConfiguration = $this->uriBuilder->_call('buildTypolinkConfiguration');
     $this->assertEquals($expectedConfiguration, $actualConfiguration);
 }
 /**
  * @test
  */
 public function prepareObjectsSliceReturnsCorrectPortionForArrayAndSecondPage()
 {
     $this->controller->_set('currentPage', 2);
     $objects = array();
     for ($i = 0; $i <= 55; $i++) {
         $item = new \stdClass();
         $objects[] = $item;
     }
     $this->controller->_set('objects', $objects);
     $expectedPortion = array();
     for ($j = 10; $j <= 19; $j++) {
         $expectedPortion = array_slice($objects, 10, 10);
     }
     $this->assertSame($expectedPortion, $this->controller->_call('prepareObjectsSlice', 10, 10));
 }
 /**
  * @dataProvider accessCheckDataProvider
  * @param $checkArray
  * @test
  */
 public function accessChecksWorksAsExpected($checkArray)
 {
     $this->fixture->expects($this->any())->method('getExtensionConfiguration')->will($this->returnValue(array('enableGroupCheck' => '1', 'groupCheckDirs' => $checkArray['groupCheckDirs'], 'excludeGroups' => $checkArray['excludedGroups'])));
     $fakeUser = new \stdClass();
     $fakeUser->groupData['uid'] = $checkArray['actualGroups'];
     $fakeUser->user['uid'] = $checkArray['actualUser'];
     $this->fixture->_set('feUserObj', $fakeUser);
     $this->fixture->_set('file', $checkArray['file']);
     $this->fixture->_set('userGroups', $checkArray['transmittedGroups']);
     $this->fixture->_set('userId', $checkArray['transmittedUser']);
     $_GET['g'] = $checkArray['transmittedGroups'];
     $_GET['u'] = $checkArray['transmittedUser'];
     $this->fixture->expects($this->once())->method('exitScript')->with('Access denied for User!');
     $this->fixture->__construct();
 }