form.test.php
来自「Cake Framwork , Excellent」· PHP 代码 · 共 1,949 行 · 第 1/5 页
PHP
1,949 行
<?php/* SVN FILE: $Id: form.test.php 7118 2008-06-04 20:49:29Z gwoo $ *//** * Short description for file. * * Long description for file * * PHP versions 4 and 5 * * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite> * Copyright 2006-2008, Cake Software Foundation, Inc. * 1785 E. Sahara Avenue, Suite 490-204 * Las Vegas, Nevada 89104 * * Licensed under The Open Group Test Suite License * Redistributions of files must retain the above copyright notice. * * @filesource * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests * @package cake.tests * @subpackage cake.tests.cases.libs.view.helpers * @since CakePHP(tm) v 1.2.0.4206 * @version $Revision: 7118 $ * @modifiedby $LastChangedBy: gwoo $ * @lastmodified $Date: 2008-06-04 13:49:29 -0700 (Wed, 04 Jun 2008) $ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License */if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) { define('CAKEPHP_UNIT_TEST_EXECUTION', 1);}uses('view'.DS.'helpers'.DS.'app_helper', 'class_registry', 'controller'.DS.'controller', 'model'.DS.'model', 'view'.DS.'helper', 'view'.DS.'helpers'.DS.'html', 'view'.DS.'view', 'view'.DS.'helpers'.DS.'form');/** * ContactTestController class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class ContactTestController extends Controller {/** * name property * * @var string 'ContactTest' * @access public */ var $name = 'ContactTest';/** * uses property * * @var mixed null * @access public */ var $uses = null;}/** * Contact class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class Contact extends CakeTestModel {/** * primaryKey property * * @var string 'id' * @access public */ var $primaryKey = 'id';/** * useTable property * * @var bool false * @access public */ var $useTable = false;/** * name property * * @var string 'Contact' * @access public */ var $name = 'Contact';/** * validate property * * @var array * @access public */ var $validate = array('non_existing' => array(), 'idontexist' => array(), 'imnotrequired' => array('required' => false, 'rule' => 'alphaNumeric'));/** * schema method * * @access public * @return void */ function schema() { $this->_schema = array( 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), 'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), 'phone' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), 'password' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), 'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null), 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) ); return $this->_schema; }/** * hasAndBelongsToMany property * * @var array * @access public */ var $hasAndBelongsToMany = array('ContactTag' => array());}Class ContactNonStandardPk extends Contact {/** * primaryKey property * * @var string 'pk' * @access public */ var $primaryKey = 'pk';/** * name property * * @var string 'ContactNonStandardPk' * @access public */ var $name = 'ContactNonStandardPk';/** * schema method * * @access public * @return void */ function schema() { $this->_schema = parent::schema(); $this->_schema['pk'] = $this->_schema['id']; unset($this->_schema['id']); return $this->_schema; }}/** * ContactTag class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class ContactTag extends Model {/** * useTable property * * @var bool false * @access public */ var $useTable = false;/** * schema method * * @access public * @return void */ function schema() { $this->_schema = array( 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '8'), 'name' => array('type' => 'string', 'null' => false, 'default' => '', 'length' => '255'), 'created' => array('type' => 'date', 'null' => true, 'default' => '', 'length' => ''), 'modified' => array('type' => 'datetime', 'null' => true, 'default' => '', 'length' => null) ); return $this->_schema; }}/** * UserForm class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class UserForm extends CakeTestModel {/** * useTable property * * @var bool false * @access public */ var $useTable = false;/** * primaryKey property * * @var string 'id' * @access public */ var $primaryKey = 'id';/** * name property * * @var string 'UserForm' * @access public */ var $name = 'UserForm';/** * hasMany property * * @var array * @access public */ var $hasMany = array('OpenidUrl' => array('className' => 'OpenidUrl', 'foreignKey' => 'user_form_id'));/** * schema method * * @access public * @return void */ function schema() { $this->_schema = array( 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), 'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null), 'other' => array('type' => 'text', 'null' => true, 'default' => null, 'length' => null), 'stuff' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 255), 'something' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 255), 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) ); return $this->_schema; }}/** * OpenidUrl class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class OpenidUrl extends CakeTestModel {/** * useTable property * * @var bool false * @access public */ var $useTable = false;/** * primaryKey property * * @var string 'id' * @access public */ var $primaryKey = 'id';/** * name property * * @var string 'OpenidUrl' * @access public */ var $name = 'OpenidUrl';/** * belongsTo property * * @var array * @access public */ var $belongsTo = array('UserForm' => array('className' => 'UserForm', 'foreignKey' => 'user_form_id'));/** * validate property * * @var array * @access public */ var $validate = array('openid_not_registered' => array());/** * schema method * * @access public * @return void */ function schema() { $this->_schema = array( 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), 'user_form_id' => array('type' => 'user_form_id', 'null' => '', 'default' => '', 'length' => '8'), 'url' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), ); return $this->_schema; }/** * beforeValidate method * * @access public * @return void */ function beforeValidate() { $this->invalidate('openid_not_registered'); return true; }}/** * ValidateUser class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class ValidateUser extends CakeTestModel {/** * primaryKey property * * @var string 'id' * @access public */ var $primaryKey = 'id';/** * useTable property * * @var bool false * @access public */ var $useTable = false;/** * name property * * @var string 'ValidateUser' * @access public */ var $name = 'ValidateUser';/** * hasOne property * * @var array * @access public */ var $hasOne = array('ValidateProfile' => array('className' => 'ValidateProfile', 'foreignKey' => 'user_id'));/** * schema method * * @access public * @return void */ function schema() { $this->_schema = array( 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), 'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), 'balance' => array('type' => 'float', 'null' => false, 'length' => '5,2'), 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null) ); return $this->_schema; }/** * beforeValidate method * * @access public * @return void */ function beforeValidate() { $this->invalidate('email'); return false; }}/** * ValidateProfile class * * @package cake * @subpackage cake.tests.cases.libs.view.helpers */class ValidateProfile extends CakeTestModel {/** * primaryKey property * * @var string 'id' * @access public */ var $primaryKey = 'id';/** * useTable property * * @var bool false * @access public */ var $useTable = false;/** * name property * * @var string 'ValidateProfile' * @access public
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?