Added test #11626: Extend unit tests for t3lib_matchCondition globalVar comparison
authorOliver Hader <oliver.hader@typo3.org>
Sun, 2 Aug 2009 14:08:57 +0000 (14:08 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Sun, 2 Aug 2009 14:08:57 +0000 (14:08 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5752 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
tests/t3lib/t3lib_matchcondition_testcase.php

index 3ff8d5e..13b3ca5 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        * Follow-up to bug #11585: Added unit test for t3lib_matchCondition
        * Fixed bug #10769: Wrong encoded email header (thanks to Ivan Kartolo)
        * Follow-up to bug #10769: Added unit tests for t3lib_div::encodeHeader()
+       * Added test #11626: Extend unit tests for t3lib_matchCondition globalVar comparison
 
 2009-08-02  Christian Kuhn  <lollli@schwarzbu.ch>
 
index 71a6950..1aa2c3c 100644 (file)
@@ -93,5 +93,68 @@ class t3lib_matchCondition_testcase extends tx_phpunit_testcase {
 
                $this->matchCondition->match('[browser = msie] && [version = 7] && [system = winNT]');
        }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function conditionMatchesOnEqualExpression() {
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 = 10]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 = 10.1]'));
+
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 == 10]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 == 10.1]'));
+       }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function conditionMatchesOnNotEqualExpression() {
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 != 20]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 != 10.2]'));
+       }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function conditionMatchesOnLowerThanExpression() {
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 < 20]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 < 10.2]'));
+       }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function conditionMatchesOnLowerThanOrEqualExpression() {
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 <= 10]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 <= 20]'));
+
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 <= 10.1]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 <= 10.2]'));
+       }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function conditionMatchesOnGreaterThanExpression() {
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20 > 10]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.2 > 10.1]'));
+       }
+
+       /**
+        * Tests whether numerical comparison matches.
+        * @test
+        */
+       public function conditionMatchesOnGreaterThanOrEqualExpression() {
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 >= 10]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20 >= 10]'));
+
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 >= 10.1]'));
+               $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.2 >= 10.1]'));
+       }
 }
 ?>
\ No newline at end of file