Permalink
Browse files

Merge branch '1.3' of github.com:cakephp/cakephp1x into 1.3

  • Loading branch information...
2 parents a726f82 + e4fa475 commit 32113a4c88251bdac2d3c8bcd7dcc4a9a2312e66 @markstory markstory committed Jan 4, 2010
@@ -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;
@@ -594,8 +594,19 @@ function testBakeValidation() {
$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);
}
/**

0 comments on commit 32113a4

Please sign in to comment.