Merge branch 'merger' into 1.3

This commit is contained in:
Mark Story 2010-01-15 13:27:19 -05:00
commit c20aba6b9c
4 changed files with 67 additions and 20 deletions

View file

@ -53,19 +53,4 @@
*/
$singularRules = array();
/**
* This is a key only array of singular words that should not be inflected.
* You should not have to change this value below if you do change it use same format
* as the $uninflectedPlural above.
*/
$uninflectedSingular = $uninflectedPlural;
/**
* This is a key => value array of singular irregular words.
* Most of the time this will be a reverse of the above $irregularPlural array
* You should not have to change this value below if you do change it use same format
*
* $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
*/
$irregularSingular = array_flip($irregularPlural);
?>

View file

@ -485,11 +485,13 @@ class CakeSchema extends Object {
if (isset($old[$table]['indexes']) && isset($new[$table]['indexes'])) {
$diff = $this->_compareIndexes($new[$table]['indexes'], $old[$table]['indexes']);
if ($diff && isset($diff['drop'])) {
$tables[$table]['drop']['indexes'] = $diff['drop'];
}
if ($diff && isset($diff['add'])) {
$tables[$table]['add']['indexes'] = $diff['add'];
if ($diff) {
if (isset($tables[$table]['drop']['indexes']) && isset($diff['drop'])) {
$tables[$table]['drop']['indexes'] = $diff['drop'];
}
if (isset($tables[$table]['add']['indexes']) && isset($diff['add'])) {
$tables[$table]['add']['indexes'] = $diff['add'];
}
}
}
if (isset($old[$table]['tableParameters']) && isset($new[$table]['tableParameters'])) {

View file

@ -69,6 +69,56 @@ class ModelValidationTest extends BaseModelTest {
);
$this->assertEqual($TestModel->invalidFields(), $expected);
$TestModel->validate['title'] = array(
'rule' => array('customValidatorWithSixParams', 'one', 'two', null, 'four'),
'required' => true
);
$TestModel->create(array('title' => 'foo'));
$TestModel->invalidFields();
$expected = array(
'data' => array(
'title' => 'foo'
),
'one' => 'one',
'two' => 'two',
'three' => null,
'four' => 'four',
'five' => array(
'rule' => array(1 => 'one', 2 => 'two', 3 => null, 4 => 'four'),
'on' => null,
'last' => false,
'allowEmpty' => false,
'required' => true
),
'six' => 6
);
$this->assertEqual($TestModel->validatorParams, $expected);
$TestModel->validate['title'] = array(
'rule' => array('customValidatorWithSixParams', 'one', array('two'), null, 'four', array('five' => 5)),
'required' => true
);
$TestModel->create(array('title' => 'foo'));
$TestModel->invalidFields();
$expected = array(
'data' => array(
'title' => 'foo'
),
'one' => 'one',
'two' => array('two'),
'three' => null,
'four' => 'four',
'five' => array('five' => 5),
'six' => array(
'rule' => array(1 => 'one', 2 => array('two'), 3 => null, 4 => 'four', 5 => array('five' => 5)),
'on' => null,
'last' => false,
'allowEmpty' => false,
'required' => true
)
);
$this->assertEqual($TestModel->validatorParams, $expected);
}
/**

View file

@ -2218,6 +2218,16 @@ class ValidationTest1 extends CakeTestModel {
function customValidatorWithMessage($data) {
return 'This field will *never* validate! Muhahaha!';
}
/**
* Test validation with many parameters
*
* @return void
*/
function customValidatorWithSixParams($data, $one = 1, $two = 2, $three = 3, $four = 4, $five = 5, $six = 6) {
$this->validatorParams = get_defined_vars();
unset($this->validatorParams['this']);
return true;
}
}
/**