| @@ 327-369 (lines=43) @@ | ||
| 324 | * |
|
| 325 | * @package Cake.Test.Case.View.Helper |
|
| 326 | */ |
|
| 327 | class ValidateUser extends CakeTestModel { |
|
| 328 | ||
| 329 | /** |
|
| 330 | * useTable property |
|
| 331 | * |
|
| 332 | * @var boolean |
|
| 333 | */ |
|
| 334 | public $useTable = false; |
|
| 335 | ||
| 336 | /** |
|
| 337 | * hasOne property |
|
| 338 | * |
|
| 339 | * @var array |
|
| 340 | */ |
|
| 341 | public $hasOne = array('ValidateProfile' => array( |
|
| 342 | 'className' => 'ValidateProfile', 'foreignKey' => 'user_id' |
|
| 343 | )); |
|
| 344 | ||
| 345 | /** |
|
| 346 | * schema method |
|
| 347 | * |
|
| 348 | * @var array |
|
| 349 | */ |
|
| 350 | protected $_schema = array( |
|
| 351 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
|
| 352 | 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), |
|
| 353 | 'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), |
|
| 354 | 'balance' => array('type' => 'float', 'null' => false, 'length' => '5,2'), |
|
| 355 | 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), |
|
| 356 | 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) |
|
| 357 | ); |
|
| 358 | ||
| 359 | /** |
|
| 360 | * beforeValidate method |
|
| 361 | * |
|
| 362 | * @return void |
|
| 363 | */ |
|
| 364 | public function beforeValidate($options = array()) { |
|
| 365 | $this->invalidate('email'); |
|
| 366 | return false; |
|
| 367 | } |
|
| 368 | ||
| 369 | } |
|
| 370 | ||
| 371 | /** |
|
| 372 | * ValidateProfile class |
|
| @@ 435-477 (lines=43) @@ | ||
| 432 | * |
|
| 433 | * @package Cake.Test.Case.View.Helper |
|
| 434 | */ |
|
| 435 | class ValidateItem extends CakeTestModel { |
|
| 436 | ||
| 437 | /** |
|
| 438 | * useTable property |
|
| 439 | * |
|
| 440 | * @var boolean |
|
| 441 | */ |
|
| 442 | public $useTable = false; |
|
| 443 | ||
| 444 | /** |
|
| 445 | * schema property |
|
| 446 | * |
|
| 447 | * @var array |
|
| 448 | */ |
|
| 449 | protected $_schema = array( |
|
| 450 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
|
| 451 | 'profile_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
|
| 452 | 'name' => array('type' => 'text', 'null' => '', 'default' => '', 'length' => '255'), |
|
| 453 | 'description' => array( |
|
| 454 | 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255' |
|
| 455 | ), |
|
| 456 | 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), |
|
| 457 | 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) |
|
| 458 | ); |
|
| 459 | ||
| 460 | /** |
|
| 461 | * belongsTo property |
|
| 462 | * |
|
| 463 | * @var array |
|
| 464 | */ |
|
| 465 | public $belongsTo = array('ValidateProfile' => array('foreignKey' => 'profile_id')); |
|
| 466 | ||
| 467 | /** |
|
| 468 | * beforeValidate method |
|
| 469 | * |
|
| 470 | * @return void |
|
| 471 | */ |
|
| 472 | public function beforeValidate($options = array()) { |
|
| 473 | $this->invalidate('description'); |
|
| 474 | return false; |
|
| 475 | } |
|
| 476 | ||
| 477 | } |
|
| 478 | ||
| 479 | /** |
|
| 480 | * TestMail class |
|