[BUGFIX] language condition does not match exact string
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Tests / Unit / Configuration / TypoScript / ConditionMatching / ConditionMatcherTest.php
index 4ef56a2..2282727 100644 (file)
@@ -54,11 +54,6 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $this->matchCondition = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Configuration\\TypoScript\\ConditionMatching\\ConditionMatcher');
        }
 
-       public function tearDown() {
-               unset($this->matchCondition);
-               unset($GLOBALS[$this->testGlobalNamespace]);
-       }
-
        /**
         * Tests whether a faulty expression fails.
         *
@@ -241,9 +236,8 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function languageConditionMatchesCompleteLanguagesExpression() {
-               $this->markTestSkipped('This comparison seems to be incomplete in \TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher.');
                $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-               $this->assertTrue($this->matchCondition->match('[language = de-de,de;q=0.8]'));
+               $this->assertTrue($this->matchCondition->match('[language = de-de,de;q=0.8,en-us;q=0.5,en;q=0.3]'));
        }
 
        /**
@@ -471,6 +465,19 @@ class ConditionMatcherTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         *
         * @test
         */
+       public function globalStringConditionMatchesOnEmptyExpressionWithValueSetToEmptyString() {
+               $testKey = uniqid('test');
+               $_GET = array();
+               $_POST = array($testKey => '');
+               $this->assertTrue($this->matchCondition->match('[globalString = GP:' . $testKey . '=]'));
+               $this->assertTrue($this->matchCondition->match('[globalString = GP:' . $testKey . ' = ]'));
+       }
+
+       /**
+        * Tests whether string comparison matches.
+        *
+        * @test
+        */
        public function globalStringConditionMatchesWildcardExpression() {
                $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3?Test?Condition]'));
                $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3.T*t.Condition]'));