mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Deprecate notEmpty in favor of notBlank.
This commit is contained in:
parent
ca768399bd
commit
866242643f
2 changed files with 32 additions and 19 deletions
|
@ -129,15 +129,15 @@ class ValidationTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testNotEmpty() {
|
||||
$this->assertTrue(Validation::notEmpty('abcdefg'));
|
||||
$this->assertTrue(Validation::notEmpty('fasdf '));
|
||||
$this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla'));
|
||||
$this->assertTrue(Validation::notEmpty('abçďĕʑʘπй'));
|
||||
$this->assertTrue(Validation::notEmpty('José'));
|
||||
$this->assertTrue(Validation::notEmpty('é'));
|
||||
$this->assertTrue(Validation::notEmpty('π'));
|
||||
$this->assertFalse(Validation::notEmpty("\t "));
|
||||
$this->assertFalse(Validation::notEmpty(""));
|
||||
$this->assertTrue(Validation::notBlank('abcdefg'));
|
||||
$this->assertTrue(Validation::notBlank('fasdf '));
|
||||
$this->assertTrue(Validation::notBlank('fooo' . chr(243) . 'blabla'));
|
||||
$this->assertTrue(Validation::notBlank('abçďĕʑʘπй'));
|
||||
$this->assertTrue(Validation::notBlank('José'));
|
||||
$this->assertTrue(Validation::notBlank('é'));
|
||||
$this->assertTrue(Validation::notBlank('π'));
|
||||
$this->assertFalse(Validation::notBlank("\t "));
|
||||
$this->assertFalse(Validation::notBlank(""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,14 +147,14 @@ class ValidationTest extends CakeTestCase {
|
|||
*/
|
||||
public function testNotEmptyISO88591AppEncoding() {
|
||||
Configure::write('App.encoding', 'ISO-8859-1');
|
||||
$this->assertTrue(Validation::notEmpty('abcdefg'));
|
||||
$this->assertTrue(Validation::notEmpty('fasdf '));
|
||||
$this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla'));
|
||||
$this->assertTrue(Validation::notEmpty('abçďĕʑʘπй'));
|
||||
$this->assertTrue(Validation::notEmpty('José'));
|
||||
$this->assertTrue(Validation::notEmpty(utf8_decode('José')));
|
||||
$this->assertFalse(Validation::notEmpty("\t "));
|
||||
$this->assertFalse(Validation::notEmpty(""));
|
||||
$this->assertTrue(Validation::notBlank('abcdefg'));
|
||||
$this->assertTrue(Validation::notBlank('fasdf '));
|
||||
$this->assertTrue(Validation::notBlank('fooo' . chr(243) . 'blabla'));
|
||||
$this->assertTrue(Validation::notBlank('abçďĕʑʘπй'));
|
||||
$this->assertTrue(Validation::notBlank('José'));
|
||||
$this->assertTrue(Validation::notBlank(utf8_decode('José')));
|
||||
$this->assertFalse(Validation::notBlank("\t "));
|
||||
$this->assertFalse(Validation::notBlank(""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,6 +48,19 @@ class Validation {
|
|||
*/
|
||||
public static $errors = array();
|
||||
|
||||
/**
|
||||
* Backwards compatibility wrapper for Validation::notBlank().
|
||||
*
|
||||
* @param string|array $check Value to check.
|
||||
* @return bool Success.
|
||||
* @deprecated 2.7.0 Use Validation::notBlank() instead.
|
||||
* @see Validation::notBlank()
|
||||
*/
|
||||
public function notEmpty($check) {
|
||||
trigger_error('Validation::notEmpty() is deprecated. Use Validation::notBlank() instead.', E_USER_DEPRECATED);
|
||||
return self::notBlank($check);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that a string contains something other than whitespace
|
||||
*
|
||||
|
@ -59,7 +72,7 @@ class Validation {
|
|||
* @param string|array $check Value to check
|
||||
* @return bool Success
|
||||
*/
|
||||
public static function notEmpty($check) {
|
||||
public static function notBlank($check) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue