Merge branch '1.3' into merger

Conflicts:
	cake/libs/configure.php
	cake/libs/controller/components/email.php
	cake/libs/model/datasources/dbo/dbo_mysqli.php
	cake/libs/view/pages/home.ctp
	cake/tests/cases/libs/controller/components/email.test.php
	cake/tests/cases/libs/model/datasources/dbo_source.test.php
	lib/Cake/Config/config.php
	lib/Cake/Console/Command/Task/ViewTask.php
	lib/Cake/Model/Datasource/DboSource.php
	lib/Cake/Model/Model.php
	lib/Cake/Test/Case/Model/ModelReadTest.php
	lib/Cake/Test/Case/Model/ModelValidationTest.php
	lib/Cake/Test/Case/Utility/InflectorTest.php
	lib/Cake/Test/Case/View/Helper/FormHelperTest.php
	lib/Cake/Utility/Inflector.php
	lib/Cake/Utility/Validation.php
	lib/Cake/VERSION.txt
	lib/Cake/View/Helper.php
	lib/Cake/View/Helper/FormHelper.php
This commit is contained in:
mark_story 2011-10-01 22:38:20 -04:00
commit c9bd97309f
16 changed files with 192 additions and 28 deletions

View file

@ -1048,6 +1048,20 @@ class FormHelperTest extends CakeTestCase {
$this->assertTags($result, $expected);
}
/**
* Test form security with Model.field.0 style inputs
*
* @return void
*/
function testFormSecurityArrayFields() {
$key = 'testKey';
$this->Form->request->params['_Token']['key'] = $key;
$this->Form->create('Address');
$this->Form->input('Address.primary.1');
$this->assertEqual('Address.primary', $this->Form->fields[0]);
}
/**
* testFormSecurityMultipleInputDisabledFields method
*
@ -1416,6 +1430,62 @@ class FormHelperTest extends CakeTestCase {
$this->assertTags($result, $expected);
}
/**
* testEmptyErrorValidation method
*
* test validation error div when validation message is an empty string
*
* @access public
* @return void
*/
function testEmptyErrorValidation() {
$this->Form->validationErrors['Contact']['password'] = '';
$result = $this->Form->input('Contact.password');
$expected = array(
'div' => array('class' => 'input password error'),
'label' => array('for' => 'ContactPassword'),
'Password',
'/label',
'input' => array(
'type' => 'password', 'name' => 'data[Contact][password]',
'id' => 'ContactPassword', 'class' => 'form-error'
),
array('div' => array('class' => 'error-message')),
array(),
'/div',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* testEmptyInputErrorValidation method
*
* test validation error div when validation message is overriden by an empty string when calling input()
*
* @access public
* @return void
*/
function testEmptyInputErrorValidation() {
$this->Form->validationErrors['Contact']['password'] = 'Please provide a password';
$result = $this->Form->input('Contact.password', array('error' => ''));
$expected = array(
'div' => array('class' => 'input password error'),
'label' => array('for' => 'ContactPassword'),
'Password',
'/label',
'input' => array(
'type' => 'password', 'name' => 'data[Contact][password]',
'id' => 'ContactPassword', 'class' => 'form-error'
),
array('div' => array('class' => 'error-message')),
array(),
'/div',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* testFormValidationAssociated method
*
@ -6147,7 +6217,7 @@ class FormHelperTest extends CakeTestCase {
$expected = array(
'form' => array(
'id' => 'ContactAddForm', 'method' => 'post',
'id' => 'ContactAddForm', 'method' => 'post',
'onsubmit' => 'someFunction();event.returnValue = false; return false;',
'action' => '/contacts/index/param',
'accept-charset' => 'utf-8'