Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove more copy + paste in tests.

  • Loading branch information...
commit 7846254c632e90cba2a4ac2c0a1065326be17848 1 parent 88465cb
@markstory markstory authored
Showing with 2 additions and 120 deletions.
  1. +2 −120 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
View
122 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -4727,84 +4727,12 @@ public function testDateTime() {
);
$this->assertTags($result, $expected);
$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
-
+
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('value' => false));
- $expected = array(
- array('select' => array('name' => 'data[Contact][date][day]', 'id' => 'ContactDateDay')),
- $daysRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- '-',
- array('select' => array('name' => 'data[Contact][date][month]', 'id' => 'ContactDateMonth')),
- $monthsRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- '-',
- array('select' => array('name' => 'data[Contact][date][year]', 'id' => 'ContactDateYear')),
- $yearsRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- array('select' => array('name' => 'data[Contact][date][hour]', 'id' => 'ContactDateHour')),
- $hoursRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- ':',
- array('select' => array('name' => 'data[Contact][date][min]', 'id' => 'ContactDateMin')),
- $minutesRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- ' ',
- array('select' => array('name' => 'data[Contact][date][meridian]', 'id' => 'ContactDateMeridian')),
- $meridianRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select'
- );
$this->assertTags($result, $expected);
$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('value' => ''));
- $expected = array(
- array('select' => array('name' => 'data[Contact][date][day]', 'id' => 'ContactDateDay')),
- $daysRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- '-',
- array('select' => array('name' => 'data[Contact][date][month]', 'id' => 'ContactDateMonth')),
- $monthsRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- '-',
- array('select' => array('name' => 'data[Contact][date][year]', 'id' => 'ContactDateYear')),
- $yearsRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- array('select' => array('name' => 'data[Contact][date][hour]', 'id' => 'ContactDateHour')),
- $hoursRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- ':',
- array('select' => array('name' => 'data[Contact][date][min]', 'id' => 'ContactDateMin')),
- $minutesRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- ' ',
- array('select' => array('name' => 'data[Contact][date][meridian]', 'id' => 'ContactDateMeridian')),
- $meridianRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select'
- );
$this->assertTags($result, $expected);
$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
@@ -4858,53 +4786,7 @@ public function testDateTime() {
$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('minuteInterval' => 5, 'value' => ''));
- $expected = array(
- array('select' => array('name' => 'data[Contact][date][day]', 'id' => 'ContactDateDay')),
- $daysRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- '-',
- array('select' => array('name' => 'data[Contact][date][month]', 'id' => 'ContactDateMonth')),
- $monthsRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- '-',
- array('select' => array('name' => 'data[Contact][date][year]', 'id' => 'ContactDateYear')),
- $yearsRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- array('select' => array('name' => 'data[Contact][date][hour]', 'id' => 'ContactDateHour')),
- $hoursRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select',
- ':',
- array('select' => array('name' => 'data[Contact][date][min]', 'id' => 'ContactDateMin')),
- $minutesRegex,
- array('option' => array('value' => '')),
- '/option',
- array('option' => array('value' => '00')),
- '00',
- '/option',
- array('option' => array('value' => '05')),
- '05',
- '/option',
- array('option' => array('value' => '10')),
- '10',
- '/option',
- '*/select',
- ' ',
- array('select' => array('name' => 'data[Contact][date][meridian]', 'id' => 'ContactDateMeridian')),
- $meridianRegex,
- array('option' => array('value' => '')),
- '/option',
- '*/select'
- );
- $this->assertTags($result, $expected);
- $this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
+ $result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('minuteInterval' => 5, 'value' => ''));
$this->Form->request->data['Contact']['data'] = null;
$result = $this->Form->dateTime('Contact.date', 'DMY', '12');
Please sign in to comment.
Something went wrong with that request. Please try again.