/** * @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 * @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 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')); }
/** * @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'); /** @var TypoScriptFrontendController $tsfe */ $tsfe = $this->accessibleFixture->_get('frontendController'); $tsfe->loginUser = TRUE; $this->assertSame(array('http://www.example.com/snafu'), $this->accessibleFixture->_call('processRedirect')); }
/** * 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'])); }
/** * @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')); }
/** * @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')); }
/** * @test */ public function addLockingStrategyAddsTheClassNameToTheInternalArray() { $this->mockFactory->addLockingStrategy(DummyLock::class); $this->assertArrayHasKey(DummyLock::class, $this->mockFactory->_get('lockingStrategy')); }
/** * @test */ public function appendContentAppendsContentCorrectly() { $this->mockResponse->_set('content', 'foo'); $this->mockResponse->appendContent('bar'); $this->assertSame('foobar', $this->mockResponse->_get('content')); }