|
|
@ -46,16 +46,20 @@ class YiiRequirementCheckerTest extends TestCase |
|
|
|
$this->assertEquals(1, $summary['warnings'], 'Wrong summary warnings!'); |
|
|
|
$this->assertEquals(1, $summary['warnings'], 'Wrong summary warnings!'); |
|
|
|
|
|
|
|
|
|
|
|
$checkedRequirements = $checkResult['requirements']; |
|
|
|
$checkedRequirements = $checkResult['requirements']; |
|
|
|
|
|
|
|
$requirementsKeys = array_flip(array_keys($requirements)); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(false, $checkedRequirements['requirementPass']['error'], 'Passed requirement has an error!'); |
|
|
|
$this->assertEquals(false, $checkedRequirements[$requirementsKeys['requirementPass']]['error'], 'Passed requirement has an error!'); |
|
|
|
$this->assertEquals(false, $checkedRequirements['requirementPass']['warning'], 'Passed requirement has a warning!'); |
|
|
|
$this->assertEquals(false, $checkedRequirements[$requirementsKeys['requirementPass']]['warning'], 'Passed requirement has a warning!'); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(true, $checkedRequirements['requirementError']['error'], 'Error requirement has no error!'); |
|
|
|
$this->assertEquals(true, $checkedRequirements[$requirementsKeys['requirementError']]['error'], 'Error requirement has no error!'); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(false, $checkedRequirements['requirementWarning']['error'], 'Error requirement has an error!'); |
|
|
|
$this->assertEquals(false, $checkedRequirements[$requirementsKeys['requirementWarning']]['error'], 'Error requirement has an error!'); |
|
|
|
$this->assertEquals(true, $checkedRequirements['requirementWarning']['warning'], 'Error requirement has no warning!'); |
|
|
|
$this->assertEquals(true, $checkedRequirements[$requirementsKeys['requirementWarning']]['warning'], 'Error requirement has no warning!'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @depends testCheck |
|
|
|
|
|
|
|
*/ |
|
|
|
public function testCheckEval() { |
|
|
|
public function testCheckEval() { |
|
|
|
$requirementsChecker = new YiiRequirementChecker(); |
|
|
|
$requirementsChecker = new YiiRequirementChecker(); |
|
|
|
|
|
|
|
|
|
|
@ -78,10 +82,46 @@ class YiiRequirementCheckerTest extends TestCase |
|
|
|
|
|
|
|
|
|
|
|
$checkResult = $requirementsChecker->check($requirements)->getResult(); |
|
|
|
$checkResult = $requirementsChecker->check($requirements)->getResult(); |
|
|
|
$checkedRequirements = $checkResult['requirements']; |
|
|
|
$checkedRequirements = $checkResult['requirements']; |
|
|
|
|
|
|
|
$requirementsKeys = array_flip(array_keys($requirements)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(false, $checkedRequirements[$requirementsKeys['requirementPass']]['error'], 'Passed requirement has an error!'); |
|
|
|
|
|
|
|
$this->assertEquals(false, $checkedRequirements[$requirementsKeys['requirementPass']]['warning'], 'Passed requirement has a warning!'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(true, $checkedRequirements[$requirementsKeys['requirementError']]['error'], 'Error requirement has no error!'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @depends testCheck |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function testCheckChained() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$requirementsChecker = new YiiRequirementChecker(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$requirements1 = array( |
|
|
|
|
|
|
|
array( |
|
|
|
|
|
|
|
'name' => 'Requirement 1', |
|
|
|
|
|
|
|
'mandatory' => true, |
|
|
|
|
|
|
|
'condition' => true, |
|
|
|
|
|
|
|
'by' => 'Requirement 1', |
|
|
|
|
|
|
|
'memo' => 'Requirement 1', |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$requirements2 = array( |
|
|
|
|
|
|
|
array( |
|
|
|
|
|
|
|
'name' => 'Requirement 2', |
|
|
|
|
|
|
|
'mandatory' => true, |
|
|
|
|
|
|
|
'condition' => true, |
|
|
|
|
|
|
|
'by' => 'Requirement 2', |
|
|
|
|
|
|
|
'memo' => 'Requirement 2', |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
$checkResult = $requirementsChecker->check($requirements1)->check($requirements2)->getResult(); |
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(false, $checkedRequirements['requirementPass']['error'], 'Passed requirement has an error!'); |
|
|
|
$mergedRequirements = array_merge($requirements1, $requirements2); |
|
|
|
$this->assertEquals(false, $checkedRequirements['requirementPass']['warning'], 'Passed requirement has a warning!'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(true, $checkedRequirements['requirementError']['error'], 'Error requirement has no error!'); |
|
|
|
$this->assertEquals(count($mergedRequirements), $checkResult['summary']['total'], 'Wrong total checks count!'); |
|
|
|
|
|
|
|
foreach ($mergedRequirements as $key => $mergedRequirement) { |
|
|
|
|
|
|
|
$this->assertEquals($mergedRequirement['name'], $checkResult['requirements'][$key]['name'], 'Wrong requirements list!'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|