|
|
@@ -5836,143 +5836,6 @@ class FormHelperTest extends TestCase {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * testFormMagicInput method
|
|
|
- *
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function testFormMagicInput() {
|
|
|
- $this->markTestIncomplete('Need to revisit once models work again.');
|
|
|
- $encoding = strtolower(Configure::read('App.encoding'));
|
|
|
- TableRegistry::get('Contacts', [
|
|
|
- 'className' => __NAMESPACE__ . '\ContactsTable'
|
|
|
- ]);
|
|
|
- $result = $this->Form->create([], ['context' => ['table' => 'Contacts']]);
|
|
|
- $expected = array(
|
|
|
- 'form' => array(
|
|
|
- 'method' => 'post', 'action' => '/articles/add',
|
|
|
- 'accept-charset' => $encoding
|
|
|
- ),
|
|
|
- 'div' => array('style' => 'display:none;'),
|
|
|
- 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
|
|
|
- '/div'
|
|
|
- );
|
|
|
- $this->assertTags($result, $expected);
|
|
|
-
|
|
|
- $result = $this->Form->input('name');
|
|
|
- $expected = array(
|
|
|
- 'div' => array('class' => 'input text'),
|
|
|
- 'label' => array('for' => 'name'),
|
|
|
- 'Name',
|
|
|
- '/label',
|
|
|
- 'input' => array(
|
|
|
- 'type' => 'text', 'name' => 'name',
|
|
|
- 'id' => 'name', 'maxlength' => '255'
|
|
|
- ),
|
|
|
- '/div'
|
|
|
- );
|
|
|
- $this->assertTags($result, $expected);
|
|
|
-
|
|
|
- $result = $this->Form->input('non_existing_field_in_contact_model');
|
|
|
- $expected = array(
|
|
|
- 'div' => array('class' => 'input text'),
|
|
|
- 'label' => array('for' => 'non-existing-field-in-contact-model'),
|
|
|
- 'Non Existing Field In Contact Model',
|
|
|
- '/label',
|
|
|
- 'input' => array(
|
|
|
- 'type' => 'text', 'name' => 'non_existing_field_in_contact_model',
|
|
|
- 'id' => 'non-existing-field-in-contact-model'
|
|
|
- ),
|
|
|
- '/div'
|
|
|
- );
|
|
|
- $this->assertTags($result, $expected);
|
|
|
-
|
|
|
- extract($this->dateRegex);
|
|
|
- $now = strtotime('now');
|
|
|
-
|
|
|
- $result = $this->Form->input('Contact.published', array(
|
|
|
- 'templates' => ['groupContainer' => '{{label}}{{input}}']
|
|
|
- ));
|
|
|
- $expected = array(
|
|
|
- 'label' => array('for' => 'ContactPublishedMonth'),
|
|
|
- 'Published',
|
|
|
- '/label',
|
|
|
- array('select' => array(
|
|
|
- 'name' => 'Contact[published][month]', 'id' => 'ContactPublishedMonth'
|
|
|
- )),
|
|
|
- $monthsRegex,
|
|
|
- array('option' => array('value' => date('m', $now), 'selected' => 'selected')),
|
|
|
- date('F', $now),
|
|
|
- '/option',
|
|
|
- '*/select',
|
|
|
- '-',
|
|
|
- array('select' => array(
|
|
|
- 'name' => 'Contact[published][day]', 'id' => 'ContactPublishedDay'
|
|
|
- )),
|
|
|
- $daysRegex,
|
|
|
- array('option' => array('value' => date('d', $now), 'selected' => 'selected')),
|
|
|
- date('j', $now),
|
|
|
- '/option',
|
|
|
- '*/select',
|
|
|
- '-',
|
|
|
- array('select' => array(
|
|
|
- 'name' => 'Contact[published][year]', 'id' => 'ContactPublishedYear'
|
|
|
- )),
|
|
|
- $yearsRegex,
|
|
|
- array('option' => array('value' => date('Y', $now), 'selected' => 'selected')),
|
|
|
- date('Y', $now),
|
|
|
- '*/select'
|
|
|
- );
|
|
|
- $this->assertTags($result, $expected);
|
|
|
-
|
|
|
- $result = $this->Form->input('Contact.updated', array('div' => false));
|
|
|
- $expected = array(
|
|
|
- 'label' => array('for' => 'ContactUpdatedMonth'),
|
|
|
- 'Updated',
|
|
|
- '/label',
|
|
|
- array('select' => array(
|
|
|
- 'name' => 'Contact[updated][month]', 'id' => 'ContactUpdatedMonth'
|
|
|
- )),
|
|
|
- $monthsRegex,
|
|
|
- array('option' => array('value' => date('m', $now), 'selected' => 'selected')),
|
|
|
- date('F', $now),
|
|
|
- '/option',
|
|
|
- '*/select',
|
|
|
- '-',
|
|
|
- array('select' => array(
|
|
|
- 'name' => 'Contact[updated][day]', 'id' => 'ContactUpdatedDay'
|
|
|
- )),
|
|
|
- $daysRegex,
|
|
|
- array('option' => array('value' => date('d', $now), 'selected' => 'selected')),
|
|
|
- date('j', $now),
|
|
|
- '/option',
|
|
|
- '*/select',
|
|
|
- '-',
|
|
|
- array('select' => array(
|
|
|
- 'name' => 'Contact[updated][year]', 'id' => 'ContactUpdatedYear'
|
|
|
- )),
|
|
|
- $yearsRegex,
|
|
|
- array('option' => array('value' => date('Y', $now), 'selected' => 'selected')),
|
|
|
- date('Y', $now),
|
|
|
- '*/select'
|
|
|
- );
|
|
|
- $this->assertTags($result, $expected);
|
|
|
-
|
|
|
- $result = $this->Form->input('UserForm.stuff');
|
|
|
- $expected = array(
|
|
|
- 'div' => array('class' => 'input text'),
|
|
|
- 'label' => array('for' => 'UserFormStuff'),
|
|
|
- 'Stuff',
|
|
|
- '/label',
|
|
|
- 'input' => array(
|
|
|
- 'type' => 'text', 'name' => 'UserForm[stuff]',
|
|
|
- 'id' => 'UserFormStuff', 'maxlength' => 10
|
|
|
- ),
|
|
|
- '/div'
|
|
|
- );
|
|
|
- $this->assertTags($result, $expected);
|
|
|
- }
|
|
|
-
|
|
|
-/**
|
|
|
* testForMagicInputNonExistingNorValidated method
|
|
|
*
|
|
|
* @return void
|