From 3b7ac70c6993eed6204f1440695b0af180efcf21 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Sat, 11 May 2013 16:27:58 +0300 Subject: [PATCH] Test case "YiiRequirementCheckerTest::testCheckEval()" has been added. --- .../requirements/YiiRequirementCheckerTest.php | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/unit/framework/requirements/YiiRequirementCheckerTest.php b/tests/unit/framework/requirements/YiiRequirementCheckerTest.php index 9661738..66a81b7 100644 --- a/tests/unit/framework/requirements/YiiRequirementCheckerTest.php +++ b/tests/unit/framework/requirements/YiiRequirementCheckerTest.php @@ -55,4 +55,33 @@ class YiiRequirementCheckerTest extends TestCase $this->assertEquals(false, $checkedRequirements['requirementWarning']['error'], 'Error requirement has an error!'); $this->assertEquals(true, $checkedRequirements['requirementWarning']['warning'], 'Error requirement has no warning!'); } + + public function testCheckEval() { + $requirementsChecker = new YiiRequirementChecker(); + + $requirements = array( + 'requirementPass' => array( + 'name' => 'Requirement 1', + 'mandatory' => true, + 'condition' => 'eval:2>1', + 'by' => 'Requirement 1', + 'memo' => 'Requirement 1', + ), + 'requirementError' => array( + 'name' => 'Requirement 2', + 'mandatory' => true, + 'condition' => 'eval:2<1', + 'by' => 'Requirement 2', + 'memo' => 'Requirement 2', + ), + ); + + $checkResult = $requirementsChecker->check($requirements)->getResult(); + $checkedRequirements = $checkResult['requirements']; + + $this->assertEquals(false, $checkedRequirements['requirementPass']['error'], 'Passed requirement has an error!'); + $this->assertEquals(false, $checkedRequirements['requirementPass']['warning'], 'Passed requirement has a warning!'); + + $this->assertEquals(true, $checkedRequirements['requirementError']['error'], 'Error requirement has no error!'); + } }