Follow-up to test #12153: Added test cases for empty comparison in globalVar condition
authorOliver Hader <oliver.hader@typo3.org>
Tue, 20 Oct 2009 09:17:35 +0000 (09:17 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 20 Oct 2009 09:17:35 +0000 (09:17 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6179 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
tests/t3lib/t3lib_matchcondition_testcase.php

index bebbe6e..babe893 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-10-20  Oliver Hader  <oliver@typo3.org>
 
        * Cleanup #12278: Move t3lib_matchCondition::whichDevice() to t3lib_utility_Client::getDeviceType()
+       * Follow-up to test #12153: Added test cases for empty comparison in globalVar condition
 
 2009-10-20  Rupert Germann  <rupi@gmx.li>
 
index 59b01da..deee5a9 100644 (file)
@@ -355,6 +355,30 @@ class t3lib_matchCondition_testcase extends tx_phpunit_testcase {
        }
 
        /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function globalVarConditionMatchesOnEmptyExpressionWithNoValueSet() {
+               $testKey = uniqid('test');
+               $this->assertTrue($this->matchCondition->match('[globalVar = GP:' . $testKey . '=]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = GP:' . $testKey . ' = ]'));
+       }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function globalVarConditionDoesNotMatchOnEmptyExpressionWithValueSetToZero() {
+               $testKey = uniqid('test');
+
+               $_GET = array();
+               $_POST = array($testKey => 0);
+
+               $this->assertFalse($this->matchCondition->match('[globalVar = GP:' . $testKey . '=]'));
+               $this->assertFalse($this->matchCondition->match('[globalVar = GP:' . $testKey . ' = ]'));
+       }
+
+       /**
         * Tests whether string comparison matches.
         * @test
         */