From: Oliver Hader Date: Sun, 2 Aug 2009 14:08:57 +0000 (+0000) Subject: Added test #11626: Extend unit tests for t3lib_matchCondition globalVar comparison X-Git-Tag: TYPO3_4-3-0beta1~308 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/29638a57084ae6f7c81069a7aee10bb4dea85d38 Added test #11626: Extend unit tests for t3lib_matchCondition globalVar comparison git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5752 709f56b5-9817-0410-a4d7-c38de5d9e867 --- diff --git a/ChangeLog b/ChangeLog index 3ff8d5e22fa9..13b3ca586315 100755 --- 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 diff --git a/tests/t3lib/t3lib_matchcondition_testcase.php b/tests/t3lib/t3lib_matchcondition_testcase.php index 71a6950aa331..1aa2c3c19383 100644 --- a/tests/t3lib/t3lib_matchcondition_testcase.php +++ b/tests/t3lib/t3lib_matchcondition_testcase.php @@ -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