Fix uploadError validation rule to work with OS Win. Here the error is string, not integer.

This commit is contained in:
euromark 2014-02-12 21:52:18 +01:00
parent 827dc77a11
commit 1725386c16
2 changed files with 3 additions and 1 deletions

View file

@ -2368,9 +2368,11 @@ class ValidationTest extends CakeTestCase {
public function testUploadError() { public function testUploadError() {
$this->assertTrue(Validation::uploadError(0)); $this->assertTrue(Validation::uploadError(0));
$this->assertTrue(Validation::uploadError(array('error' => 0))); $this->assertTrue(Validation::uploadError(array('error' => 0)));
$this->assertTrue(Validation::uploadError(array('error' => '0')));
$this->assertFalse(Validation::uploadError(2)); $this->assertFalse(Validation::uploadError(2));
$this->assertFalse(Validation::uploadError(array('error' => 2))); $this->assertFalse(Validation::uploadError(array('error' => 2)));
$this->assertFalse(Validation::uploadError(array('error' => '2')));
} }
/** /**

View file

@ -964,7 +964,7 @@ class Validation {
$check = $check['error']; $check = $check['error'];
} }
return $check === UPLOAD_ERR_OK; return (int)$check === UPLOAD_ERR_OK;
} }
/** /**