/** * @test * @return void */ public function extractInformationForConfigFieldsOfTypeOptionsWithLabelsAndValuesAddsGenericTypeAndLabelInformation() { $option = array('cat' => 'basic', 'subcat_name' => 'enable', 'subcat' => 'a/enable/100z', 'type' => 'options[Minimal (Most features disabled. Administrator needs to enable them using TypoScript. For advanced administrators only.)=MINIMAL,Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.) = TYPICAL,Demo (Show-off configuration. Includes pre-configured styles. Not for production environments.)=DEMO]', 'label' => 'Default configuration settings', 'name' => 'defaultConfiguration', 'value' => 'Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.)', 'default_value' => 'Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.)', 'genericComparisonValue' => array('Minimal (Most features disabled. Administrator needs to enable them using TypoScript. For advanced administrators only.)' => 'MINIMAL', 'Typical (Most commonly used features are enabled. Select this option if you are unsure which one to use.)' => 'TYPICAL', 'Demo (Show-off configuration. Includes pre-configured styles. Not for production environments.)' => 'DEMO'), 'typeComparisonValue' => 'options'); $optionModified = $this->configurationItemRepository->_callRef('extractInformationForConfigFieldsOfTypeOptions', $option); $this->assertArrayHasKey('generic', $optionModified); $this->assertArrayHasKey('type', $optionModified); $this->assertArrayHasKey('label', $optionModified); $this->assertEquals($option['genericComparisonValue'], $optionModified['generic']); $this->assertEquals($option['typeComparisonValue'], $optionModified['type']); }
/** * @test */ public function removeDefaultControllerAndActionRemovesControllerAndActionIfBothAreEqualToTheDefault() { $this->mockExtensionService->expects($this->atLeastOnce())->method('getDefaultControllerNameByPlugin')->with('ExtensionName', 'PluginName')->will($this->returnValue('DefaultController')); $this->mockExtensionService->expects($this->atLeastOnce())->method('getDefaultActionNameByPluginAndController')->with('ExtensionName', 'PluginName', 'DefaultController')->will($this->returnValue('defaultAction')); $arguments = array('controller' => 'DefaultController', 'action' => 'defaultAction', 'foo' => 'bar'); $extensionName = 'ExtensionName'; $pluginName = 'PluginName'; $expectedResult = array('foo' => 'bar'); $actualResult = $this->uriBuilder->_callRef('removeDefaultControllerAndAction', $arguments, $extensionName, $pluginName); $this->assertEquals($expectedResult, $actualResult); }
/** * @test * @see http://forge.typo3.org/issues/23374 */ public function questionMarkParametersMayBeSafelyReplaced() { $sql = 'SELECT * FROM pages WHERE pid = ? AND timestamp < ? AND title != \'How to test?\''; $parameterValues = array(12, 1281782690); $components = $this->subject->_callRef('parseSELECT', $sql); for ($i = 0; $i < count($components['parameters']['?']); $i++) { $components['parameters']['?'][$i][0] = $parameterValues[$i]; } $result = $this->subject->_callRef('compileSELECT', $components); $expected = 'SELECT * FROM pages WHERE pid = 12 AND timestamp < 1281782690 AND title != \'How to test?\''; $this->assertEquals($expected, $this->cleanSql($result)); }
/** * @test * @see http://forge.typo3.org/issues/21718 */ public function cachingFrameworkQueryIsRemapped() { $currentTime = time(); $table = 'cachingframework_cache_hash_tags'; $where = 'identifier IN (' . $this->subject->SELECTsubquery('identifier', 'cachingframework_cache_pages', 'crdate + lifetime < ' . $currentTime . ' AND lifetime > 0') . ')'; // Perform remapping (as in method exec_DELETEquery) $tableArray = $this->subject->_call('map_needMapping', $table); // Where clause: $whereParts = $this->subject->SQLparser->parseWhereClause($where); $this->subject->_callRef('map_sqlParts', $whereParts, $tableArray[0]['table']); $where = $this->subject->SQLparser->compileWhereClause($whereParts, FALSE); // Table name: if ($this->subject->mapping[$table]['mapTableName']) { $table = $this->subject->mapping[$table]['mapTableName']; } $result = $this->subject->DELETEquery($table, $where); $expected = 'DELETE FROM "cf_cache_hash_tags" WHERE "identifier" IN ('; $expected .= 'SELECT "identifier" FROM "cf_cache_pages" WHERE "crdate"+"lifetime" < ' . $currentTime . ' AND "lifetime" > 0'; $expected .= ')'; $this->assertEquals($expected, $this->cleanSql($result)); }
/** * @test * @dataProvider canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifierDataProvider * @param string $expectedPath * @param string $identifier */ public function canonicalizeAndCheckFolderIdentifierCanonicalizesFolderIdentifier($expectedPath, $identifier) { $this->assertSame($expectedPath, $this->subject->_callRef('canonicalizeAndCheckFolderIdentifier', $identifier)); }
/** * @test */ public function roundTripCryptStringAppliedTwoTimesReturnsOriginalString() { $clearText = 'Hello world!'; $refValue = $this->fixture->_callRef('roundTripCryptString', $clearText); $this->assertEquals($clearText, $this->fixture->_callRef('roundTripCryptString', $refValue)); }
/** * @test * @expectedException \InvalidArgumentException */ public function callRefForTenParametersThrowsException() { $this->accessibleMock->_callRef('argumentChecker', $parameter, $parameter, $parameter, $parameter, $parameter, $parameter, $parameter, $parameter, $parameter, $parameter); }