|
|
@@ -8171,10 +8171,10 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesSettersGetters()
|
|
|
+ public function testFormValueSourcesSettersGetters()
|
|
|
{
|
|
|
$expected = ['context'];
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
$expected = null;
|
|
|
@@ -8182,34 +8182,34 @@ class FormHelperTest extends TestCase
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
$expected = ['query', 'data', 'context'];
|
|
|
- $this->Form->setValuesSources(['query', 'data', 'invalid', 'context', 'foo']);
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $this->Form->setValueSources(['query', 'data', 'invalid', 'context', 'foo']);
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
|
|
|
$this->Form->request->data['id'] = '1';
|
|
|
$this->Form->request->query['id'] = '2';
|
|
|
|
|
|
- $this->Form->setValuesSources(['context']);
|
|
|
+ $this->Form->setValueSources(['context']);
|
|
|
$expected = '1';
|
|
|
$result = $this->Form->getSourceValue('id');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources('query');
|
|
|
+ $this->Form->setValueSources('query');
|
|
|
$expected = ['query'];
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
$expected = '2';
|
|
|
$result = $this->Form->getSourceValue('id');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['data']);
|
|
|
+ $this->Form->setValueSources(['data']);
|
|
|
$expected = '1';
|
|
|
$result = $this->Form->getSourceValue('id');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['query', 'data']);
|
|
|
+ $this->Form->setValueSources(['query', 'data']);
|
|
|
$expected = '2';
|
|
|
$result = $this->Form->getSourceValue('id');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
@@ -8220,7 +8220,7 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesSingleSwitchRendering()
|
|
|
+ public function testFormValueSourcesSingleSwitchRendering()
|
|
|
{
|
|
|
$this->loadFixtures('Articles');
|
|
|
$articles = TableRegistry::get('Articles');
|
|
|
@@ -8229,7 +8229,7 @@ class FormHelperTest extends TestCase
|
|
|
|
|
|
|
|
|
$this->Form->create($article);
|
|
|
- $this->Form->setValuesSources(['context']);
|
|
|
+ $this->Form->setValueSources(['context']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '3']],
|
|
|
@@ -8238,7 +8238,7 @@ class FormHelperTest extends TestCase
|
|
|
|
|
|
|
|
|
$this->Form->request->query['id'] = '5';
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
$this->Form->create($article);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
@@ -8247,7 +8247,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
$this->Form->create($article);
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '5']],
|
|
|
@@ -8258,7 +8258,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->query['id'] = '5a';
|
|
|
$this->Form->request->data['id'] = '5b';
|
|
|
|
|
|
- $this->Form->setValuesSources(['context']);
|
|
|
+ $this->Form->setValueSources(['context']);
|
|
|
$this->Form->create($article);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
@@ -8266,7 +8266,7 @@ class FormHelperTest extends TestCase
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['data']);
|
|
|
+ $this->Form->setValueSources(['data']);
|
|
|
$this->Form->create($article);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
@@ -8277,7 +8277,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->data['id'] = '6';
|
|
|
$this->Form->request->query['id'] = '7';
|
|
|
$this->Form->create($article);
|
|
|
- $this->Form->setValuesSources(['data']);
|
|
|
+ $this->Form->setValueSources(['data']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '6']],
|
|
|
@@ -8287,7 +8287,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->data['id'] = '8';
|
|
|
$this->Form->request->query['id'] = '9';
|
|
|
$this->Form->create($article);
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '9']],
|
|
|
@@ -8301,7 +8301,7 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesListSwitchRendering()
|
|
|
+ public function testFormValueSourcesListSwitchRendering()
|
|
|
{
|
|
|
$this->loadFixtures('Articles');
|
|
|
$articles = TableRegistry::get('Articles');
|
|
|
@@ -8311,35 +8311,35 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->query['id'] = '9';
|
|
|
|
|
|
$this->Form->create($article);
|
|
|
- $this->Form->setValuesSources(['context']);
|
|
|
+ $this->Form->setValueSources(['context']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '3']],
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '9']],
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['context', 'query']);
|
|
|
+ $this->Form->setValueSources(['context', 'query']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '3']],
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['query', 'context']);
|
|
|
+ $this->Form->setValueSources(['query', 'context']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '9']],
|
|
|
];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['data', 'query', 'context']);
|
|
|
+ $this->Form->setValueSources(['data', 'query', 'context']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '9']],
|
|
|
@@ -8349,7 +8349,7 @@ class FormHelperTest extends TestCase
|
|
|
|
|
|
$this->Form->request->data['id'] = '8';
|
|
|
$this->Form->request->query['id'] = '9';
|
|
|
- $this->Form->setValuesSources(['data', 'query', 'context']);
|
|
|
+ $this->Form->setValueSources(['data', 'query', 'context']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '8']],
|
|
|
@@ -8362,7 +8362,7 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesSwitchViaOptionsRendering()
|
|
|
+ public function testFormValueSourcesSwitchViaOptionsRendering()
|
|
|
{
|
|
|
$this->loadFixtures('Articles');
|
|
|
$articles = TableRegistry::get('Articles');
|
|
|
@@ -8373,7 +8373,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->data['id'] = '4';
|
|
|
$this->Form->request->query['id'] = '5';
|
|
|
|
|
|
- $this->Form->create($article, ['valuesSources' => 'query']);
|
|
|
+ $this->Form->create($article, ['valueSources' => 'query']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '5']],
|
|
|
@@ -8386,8 +8386,8 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->data['id'] = '6';
|
|
|
$this->Form->request->query['id'] = '7';
|
|
|
|
|
|
- $this->Form->setValuesSources(['context']);
|
|
|
- $this->Form->create($article, ['valuesSources' => 'query']);
|
|
|
+ $this->Form->setValueSources(['context']);
|
|
|
+ $this->Form->create($article, ['valueSources' => 'query']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '7']],
|
|
|
@@ -8396,8 +8396,8 @@ class FormHelperTest extends TestCase
|
|
|
$result = $this->Form->getSourceValue('id');
|
|
|
$this->assertEquals('7', $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
- $this->Form->create($article, ['valuesSources' => 'data']);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
+ $this->Form->create($article, ['valueSources' => 'data']);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '6']],
|
|
|
@@ -8410,8 +8410,8 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->data['id'] = '8';
|
|
|
$this->Form->request->query['id'] = '9';
|
|
|
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
- $this->Form->create($article, ['valuesSources' => ['context', 'data']]);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
+ $this->Form->create($article, ['valueSources' => ['context', 'data']]);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '8']],
|
|
|
@@ -8426,7 +8426,7 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesSwitchViaOptionsAndSetterRendering()
|
|
|
+ public function testFormValueSourcesSwitchViaOptionsAndSetterRendering()
|
|
|
{
|
|
|
$this->loadFixtures('Articles');
|
|
|
$articles = TableRegistry::get('Articles');
|
|
|
@@ -8437,7 +8437,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->Form->request->data['id'] = '10';
|
|
|
$this->Form->request->query['id'] = '11';
|
|
|
|
|
|
- $this->Form->setValuesSources(['context'])->create($article, ['valuesSources' => ['query', 'data']]);
|
|
|
+ $this->Form->setValueSources(['context'])->create($article, ['valueSources' => ['query', 'data']]);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '11']],
|
|
|
@@ -8447,7 +8447,7 @@ class FormHelperTest extends TestCase
|
|
|
$this->assertEquals('11', $result);
|
|
|
|
|
|
unset($this->Form->request->query['id']);
|
|
|
- $this->Form->setValuesSources(['context'])->create($article, ['valuesSources' => ['query', 'data']]);
|
|
|
+ $this->Form->setValueSources(['context'])->create($article, ['valueSources' => ['query', 'data']]);
|
|
|
$result = $this->Form->input('id');
|
|
|
$expected = [
|
|
|
['input' => ['type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => '10']],
|
|
|
@@ -8462,25 +8462,25 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesResetViaEnd()
|
|
|
+ public function testFormValueSourcesResetViaEnd()
|
|
|
{
|
|
|
$expected = ['context'];
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
$expected = ['query', 'context', 'data'];
|
|
|
- $this->Form->setValuesSources(['query', 'context', 'data']);
|
|
|
+ $this->Form->setValueSources(['query', 'context', 'data']);
|
|
|
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
$this->Form->create();
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
$this->Form->end();
|
|
|
$expected = ['context'];
|
|
|
- $result = $this->Form->getValuesSources();
|
|
|
+ $result = $this->Form->getValueSources();
|
|
|
$this->assertEquals($expected, $result);
|
|
|
}
|
|
|
|
|
|
@@ -8489,7 +8489,7 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesSchemaDefaults()
|
|
|
+ public function testFormValueSourcesSchemaDefaults()
|
|
|
{
|
|
|
$Articles = TableRegistry::get('Articles');
|
|
|
$entity = $Articles->newEntity();
|
|
|
@@ -8518,11 +8518,11 @@ class FormHelperTest extends TestCase
|
|
|
);
|
|
|
$entity = $Articles->newEntity();
|
|
|
$this->Form->create($entity);
|
|
|
- $this->Form->setValuesSources(['query']);
|
|
|
+ $this->Form->setValueSources(['query']);
|
|
|
$result = $this->Form->getSourceValue('title');
|
|
|
$expected = '';
|
|
|
$this->assertEquals($expected, $result);
|
|
|
- $this->Form->setValuesSources(['context']);
|
|
|
+ $this->Form->setValueSources(['context']);
|
|
|
$result = $this->Form->getSourceValue('title');
|
|
|
$expected = 'default title';
|
|
|
$this->assertEquals($expected, $result);
|
|
|
@@ -8533,7 +8533,7 @@ class FormHelperTest extends TestCase
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testFormValuesSourcesDefaults()
|
|
|
+ public function testFormValueSourcesDefaults()
|
|
|
{
|
|
|
$this->Form->request->query['password'] = 'open Sesame';
|
|
|
$this->Form->create();
|
|
|
@@ -8546,12 +8546,12 @@ class FormHelperTest extends TestCase
|
|
|
$expected = ['input' => ['type' => 'password', 'name' => 'password', 'value' => 'helloworld']];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources('query');
|
|
|
+ $this->Form->setValueSources('query');
|
|
|
$result = $this->Form->password('password', ['default' => 'helloworld']);
|
|
|
$expected = ['input' => ['type' => 'password', 'name' => 'password', 'value' => 'open Sesame']];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources('data');
|
|
|
+ $this->Form->setValueSources('data');
|
|
|
$result = $this->Form->password('password', ['default' => 'helloworld']);
|
|
|
$expected = ['input' => ['type' => 'password', 'name' => 'password', 'value' => 'helloworld']];
|
|
|
$this->assertHtml($expected, $result);
|
|
|
@@ -8571,12 +8571,12 @@ class FormHelperTest extends TestCase
|
|
|
$entity = $Articles->newEntity();
|
|
|
$this->Form->create($entity);
|
|
|
|
|
|
- $this->Form->setValuesSources(['query', 'context']);
|
|
|
+ $this->Form->setValueSources(['query', 'context']);
|
|
|
$result = $this->Form->getSourceValue('category');
|
|
|
$expected = 'sesame-cookies';
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
- $this->Form->setValuesSources(['context', 'query']);
|
|
|
+ $this->Form->setValueSources(['context', 'query']);
|
|
|
$result = $this->Form->getSourceValue('category');
|
|
|
$expected = 'sesame-cookies';
|
|
|
$this->assertEquals($expected, $result);
|