diff --git a/cake/console/templates/default/classes/model.ctp b/cake/console/templates/default/classes/model.ctp index a1a70a390..67c40ba4d 100644 --- a/cake/console/templates/default/classes/model.ctp +++ b/cake/console/templates/default/classes/model.ctp @@ -42,7 +42,14 @@ if (!empty($validate)): foreach ($validate as $field => $validations): echo "\t\t'$field' => array(\n"; foreach ($validations as $key => $validator): - echo "\t\t\t'$key' => array('rule' => array('$validator')),\n"; + echo "\t\t\t'$key' => array(\n"; + echo "\t\t\t\t'rule' => array('$validator'),\n"; + echo "\t\t\t\t//'message' => 'Your custom message here',\n"; + echo "\t\t\t\t//'allowEmpty' => false,\n"; + echo "\t\t\t\t//'required' => false,\n"; + echo "\t\t\t\t//'last' => false, // Stop validation after this rule\n"; + echo "\t\t\t\t//'on' => 'create', // Limit validation to 'create' or 'update' operations\n"; + echo "\t\t\t),\n"; endforeach; echo "\t\t),\n"; endforeach; diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php index 484cbe06c..8d99642e2 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/libs/tasks/model.test.php @@ -594,8 +594,19 @@ class ModelTaskTest extends CakeTestCase { $this->assertPattern('/class Article extends AppModel \{/', $result); $this->assertPattern('/\$name \= \'Article\'/', $result); $this->assertPattern('/\$validate \= array\(/', $result); - $pattern = '/' . preg_quote("'notempty' => array('rule' => array('notempty')),", '/') . '/'; - $this->assertPattern($pattern, $result); + $expected = <<< STRINGEND +array( + 'notempty' => array( + 'rule' => array('notempty'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), +STRINGEND; + + $this->assertPattern('/' . preg_quote($expected, '/') . '/', $result); } /** diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index 2938d9630..0d9e86235 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -2115,7 +2115,9 @@ class DispatcherTest extends CakeTestCase { $_SERVER['PHP_SELF'] = '/'; Router::reload(); - Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)); + App::build(array( + 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) + )); $dispatcher =& new Dispatcher(); $dispatcher->base = false;