* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice * * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests * @since 1.2.0 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ namespace Cake\Test\TestCase\View\Helper; use Cake\Collection\Collection; use Cake\Controller\Controller; use Cake\Core\App; use Cake\Core\Configure; use Cake\Core\Plugin; use Cake\Network\Request; use Cake\ORM\Entity; use Cake\ORM\Table; use Cake\ORM\TableRegistry; use Cake\Routing\Router; use Cake\TestSuite\TestCase; use Cake\Utility\Security; use Cake\View\Helper\FormHelper; use Cake\View\Helper\HtmlHelper; use Cake\View\View; /** * Test stub. */ class Article extends Entity { } /** * Contact class * */ class ContactsTable extends Table { /** * Default schema * * @var array */ protected $_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), 'age' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => null), '_constraints' => array('primary' => ['type' => 'primary', 'columns' => ['id']]) ); /** * Initializes the schema * * @return void */ public function initialize(array $config) { $this->schema($this->_schema); } } /** * ValidateUser class * */ class ValidateUsersTable extends Table { /** * schema method * * @var array */ protected $_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, 'precision' => 2), 'cost_decimal' => array('type' => 'decimal', 'null' => false, 'length' => 6, 'precision' => 3), 'ratio' => array('type' => 'decimal', 'null' => false, 'length' => 10, 'precision' => 6), 'population' => array('type' => 'decimal', 'null' => false, 'length' => 15, 'precision' => 0), 'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''), 'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null), '_constraints' => array('primary' => ['type' => 'primary', 'columns' => ['id']]) ); /** * Initializes the schema * * @return void */ public function initialize(array $config) { $this->schema($this->_schema); } } /** * FormHelperTest class * * @property FormHelper $Form */ class FormHelperTest extends TestCase { /** * Fixtures to be used * * @var array */ public $fixtures = array('core.article', 'core.comment'); /** * Do not load the fixtures by default * * @var bool */ public $autoFixtures = false; /** * setUp method * * @return void */ public function setUp() { parent::setUp(); Configure::write('Config.language', 'eng'); Configure::write('App.base', ''); Configure::write('App.namespace', 'Cake\Test\TestCase\View\Helper'); Configure::delete('Asset'); $this->View = new View(); $this->Form = new FormHelper($this->View); $this->Form->request = new Request('articles/add'); $this->Form->request->here = '/articles/add'; $this->Form->request['controller'] = 'articles'; $this->Form->request['action'] = 'add'; $this->Form->request->webroot = ''; $this->Form->request->base = ''; $this->dateRegex = array( 'daysRegex' => 'preg:/(?: