mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 07:29:51 +00:00
Merge branch '1.3' of git://github.com/cakephp/cakephp into 1.3
This commit is contained in:
commit
548f09c39b
2 changed files with 14 additions and 1 deletions
|
@ -353,6 +353,7 @@ class ModelTask extends BakeTask {
|
||||||
$default++;
|
$default++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$choices[$default] = 'none'; // Needed since index starts at 1
|
||||||
$this->_validations = $choices;
|
$this->_validations = $choices;
|
||||||
return $choices;
|
return $choices;
|
||||||
}
|
}
|
||||||
|
@ -391,6 +392,8 @@ class ModelTask extends BakeTask {
|
||||||
if ($metaData['null'] != 1 && !in_array($fieldName, array($primaryKey, 'created', 'modified', 'updated'))) {
|
if ($metaData['null'] != 1 && !in_array($fieldName, array($primaryKey, 'created', 'modified', 'updated'))) {
|
||||||
if ($fieldName == 'email') {
|
if ($fieldName == 'email') {
|
||||||
$guess = $methods['email'];
|
$guess = $methods['email'];
|
||||||
|
} elseif ($metaData['type'] == 'string' && $metaData['length'] == 36) {
|
||||||
|
$guess = $methods['uuid'];
|
||||||
} elseif ($metaData['type'] == 'string') {
|
} elseif ($metaData['type'] == 'string') {
|
||||||
$guess = $methods['notempty'];
|
$guess = $methods['notempty'];
|
||||||
} elseif ($metaData['type'] == 'integer') {
|
} elseif ($metaData['type'] == 'integer') {
|
||||||
|
|
|
@ -197,21 +197,31 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||||
$expected = array('notempty' => 'notempty');
|
$expected = array('notempty' => 'notempty');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'date', 'length' => 10, 'null' => false));
|
||||||
$expected = array('date' => 'date');
|
$expected = array('date' => 'date');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('text', array('type' => 'time', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('text', array('type' => 'time', 'length' => 10, 'null' => false));
|
||||||
$expected = array('time' => 'time');
|
$expected = array('time' => 'time');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('email', array('type' => 'string', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('email', array('type' => 'string', 'length' => 10, 'null' => false));
|
||||||
$expected = array('email' => 'email');
|
$expected = array('email' => 'email');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('test', array('type' => 'integer', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('test', array('type' => 'integer', 'length' => 10, 'null' => false));
|
||||||
$expected = array('numeric' => 'numeric');
|
$expected = array('numeric' => 'numeric');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$result = $this->Task->fieldValidation('test', array('type' => 'boolean', 'length' => 10, 'null' => false));
|
$result = $this->Task->fieldValidation('test', array('type' => 'boolean', 'length' => 10, 'null' => false));
|
||||||
$expected = array('numeric' => 'numeric');
|
$expected = array('boolean' => 'boolean');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
|
$result = $this->Task->fieldValidation('test', array('type' => 'string', 'length' => 36, 'null' => false));
|
||||||
|
$expected = array('uuid' => 'uuid');
|
||||||
|
$this->assertEqual($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue