mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
tests to disprove that input date and partial dateFormat does not work
This commit is contained in:
parent
468eb94e94
commit
290c343a74
1 changed files with 55 additions and 0 deletions
|
@ -6628,6 +6628,61 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertEquals($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInputDate method
|
||||
*
|
||||
* Test various inputs with type date and different dateFormat values
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInputDate() {
|
||||
$this->Form->request->data = array();
|
||||
$this->Form->create('User');
|
||||
$result = $this->Form->input('month_year',
|
||||
array(
|
||||
'label' => false,
|
||||
'div' => false,
|
||||
'type' => 'date',
|
||||
'dateFormat' => 'MY',
|
||||
'minYear' => 2006,
|
||||
'maxYear' => 2008
|
||||
)
|
||||
);
|
||||
$this->assertContains('value="' . date('m') . '" selected="selected"', $result);
|
||||
$this->assertContains('value="2008" selected="selected"', $result);
|
||||
|
||||
$result = $this->Form->input('just_year',
|
||||
array(
|
||||
'type' => 'date',
|
||||
'label' => false,
|
||||
'dateFormat' => 'Y',
|
||||
'minYear' => date('Y'),
|
||||
'maxYear' => date('Y', strtotime('+20 years'))
|
||||
)
|
||||
);
|
||||
$this->assertContains('value="' . date('Y') . '" selected="selected"', $result);
|
||||
|
||||
$result = $this->Form->input('just_month',
|
||||
array(
|
||||
'type' => 'date',
|
||||
'label' => false,
|
||||
'dateFormat' => 'M',
|
||||
'empty' => false,
|
||||
)
|
||||
);
|
||||
$this->assertContains('value="' . date('m') . '" selected="selected"', $result);
|
||||
|
||||
$result = $this->Form->input('just_day',
|
||||
array(
|
||||
'type' => 'date',
|
||||
'label' => false,
|
||||
'dateFormat' => 'D',
|
||||
'empty' => false,
|
||||
)
|
||||
);
|
||||
$this->assertContains('value="' . date('d') . '" selected="selected"', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInputDateMaxYear method
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue