/**
  * @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'));
 }
 /**
  * @test
  */
 public function acceptObjectStorageAsObjects()
 {
     $objects = new ObjectStorage();
     $this->controller->_set('objects', $objects);
     $this->controller->indexAction();
     $this->assertSame($objects, $this->controller->_get('objects'));
 }
 /**
  * @test
  */
 public function buildCorrectlySetsAllowedControllerActions()
 {
     $this->injectDependencies();
     $expectedResult = array('TheFirstController' => array('show', 'index', 'new', 'create', 'delete', 'edit', 'update', 'setup', 'test'), 'TheSecondController' => array('show', 'index'), 'TheThirdController' => array('delete', 'create', 'onlyInThirdController'));
     $this->requestBuilder->build();
     $actualResult = $this->requestBuilder->_get('allowedControllerActions');
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * @test
  */
 public function updateRootlineDataOverwritesOwnArrayData()
 {
     $originalRootline = array(0 => array('uid' => 2, 'title' => 'originalTitle'), 1 => array('uid' => 3, 'title' => 'originalTitle2'));
     $updatedRootline = array(0 => array('uid' => 1, 'title' => 'newTitle'), 1 => array('uid' => 2, 'title' => 'newTitle2'), 2 => array('uid' => 3, 'title' => 'newTitle3'));
     $expectedRootline = array(0 => array('uid' => 2, 'title' => 'newTitle2'), 1 => array('uid' => 3, 'title' => 'newTitle3'));
     $this->templateServiceMock->_set('rootLine', $originalRootline);
     $this->templateServiceMock->updateRootlineData($updatedRootline);
     $this->assertEquals($expectedRootline, $this->templateServiceMock->_get('rootLine'));
 }
 /**
  * Tests optimizing a CSS asset group.
  *
  * @test
  * @dataProvider compressCssFileContentDataProvider
  * @param string $cssFile
  * @param string $expected
  */
 public function compressCssFileContent($cssFile, $expected)
 {
     $cssContent = file_get_contents($cssFile);
     $compressedCss = $this->subject->_call('compressCssString', $cssContent);
     // we have to fix relative paths, if we aren't working on a file in our target directory
     $relativeFilename = str_replace(PATH_site, '', $cssFile);
     if (strpos($relativeFilename, $this->subject->_get('targetDirectory')) === false) {
         $compressedCss = $this->subject->_call('cssFixRelativeUrlPaths', $compressedCss, dirname($relativeFilename) . '/');
     }
     $this->assertEquals(file_get_contents($expected), $compressedCss, 'Group of file CSS assets optimized correctly.');
 }
 /**
  * @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
  * @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 #8
0
 /**
  * @test
  */
 public function setDefaultsSetsDefaultsCorrectly()
 {
     $this->task->setDefaults(array('Foo'));
     $this->assertSame(array('Foo'), $this->task->_get('defaults'));
 }
 /**
  * @param array $expectedTags
  * @param array $configuration
  * @test
  * @dataProvider stdWrap_addPageCacheTagsAddsPageTagsDataProvider
  */
 public function stdWrap_addPageCacheTagsAddsPageTags(array $expectedTags, array $configuration)
 {
     $this->subject->stdWrap_addPageCacheTags('', $configuration);
     $this->assertEquals($expectedTags, $this->typoScriptFrontendControllerMock->_get('pageCacheTags'));
 }
 /**
  * @test
  */
 public function flashMessageServiceInitiallyIsEmpty()
 {
     $this->assertSame(array(), $this->flashMessageService->_get('flashMessageQueues'));
 }
 /**
  * @test
  */
 public function constructCreatesInstanceOfFluidStandaloneView()
 {
     $this->assertInstanceOf('TYPO3\\CMS\\Fluid\\View\\StandaloneView', $this->fixture->_get('view'));
 }
Example #12
0
 /**
  * @test
  */
 public function publicPropertyForAccessibleMockObjectIsDirectlyAccessible()
 {
     self::assertSame('This is a public property.', $this->accessibleMock->_get('publicProperty'));
 }
 /**
  * @param array $expectedTags
  * @param array $configuration
  * @test
  * @dataProvider stdWrap_addPageCacheTagsAddsPageTagsDataProvider
  */
 public function stdWrap_addPageCacheTagsAddsPageTags(array $expectedTags, array $configuration)
 {
     $this->cObj->stdWrap_addPageCacheTags('', $configuration);
     $this->assertEquals($expectedTags, $this->tsfe->_get('pageCacheTags'));
 }
Example #14
0
 /**
  * @test
  */
 public function addLockingStrategyAddsTheClassNameToTheInternalArray()
 {
     $this->mockFactory->addLockingStrategy(DummyLock::class);
     $this->assertArrayHasKey(DummyLock::class, $this->mockFactory->_get('lockingStrategy'));
 }
Example #15
0
 /**
  * @test
  */
 public function appendContentAppendsContentCorrectly()
 {
     $this->mockResponse->_set('content', 'foo');
     $this->mockResponse->appendContent('bar');
     $this->assertSame('foobar', $this->mockResponse->_get('content'));
 }