mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #7752 from ichikaway/2.7-remove-extract
remove extract function in the Validation::comparison
This commit is contained in:
commit
caf93bf923
2 changed files with 0 additions and 40 deletions
|
@ -917,42 +917,6 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertFalse(Validation::comparison('0x02', '>=', 1.5), 'hex string data fails');
|
||||
}
|
||||
|
||||
/**
|
||||
* testComparisonAsArray method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testComparisonAsArray() {
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'is greater', 'check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '>', 'check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => 'is less', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => '<', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'greater or equal', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '>=', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'greater or equal', 'check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '>=', 'check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => 'less or equal', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => '<=', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'equal to', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '==', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'not equal', 'check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '!=', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 6, 'operator' => 'is greater', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 6, 'operator' => '>', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'is less', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '<', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 6, 'operator' => 'greater or equal', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 6, 'operator' => '>=', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 6, 'operator' => 'greater or equal', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 6, 'operator' => '>=', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'less or equal', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '<=', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'equal to', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '==', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'not equal', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '!=', 'check2' => 7)));
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustom method
|
||||
*
|
||||
|
|
|
@ -231,10 +231,6 @@ class Validation {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function comparison($check1, $operator = null, $check2 = null) {
|
||||
if (is_array($check1)) {
|
||||
extract($check1, EXTR_OVERWRITE);
|
||||
}
|
||||
|
||||
if ((float)$check1 != $check1) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue