1 form.test | public FormH5datetimeTestCase::testNoAccessH5DateOrTimeElement() |
Test return value for disabled html_date and html_time elements.
These two FAPI elements use an array for #default_value, so, the value callback function html_date_or_time_value_callback needs to take care of converting the array to a string upon submission of a form that contains them.
File
- core/
modules/ simpletest/ tests/ form.test, line 2470 - Unit tests for the Backdrop Form API.
Class
- FormH5datetimeTestCase
- Tests html5 date and time elements.
Code
public function testNoAccessH5DateOrTimeElement() {
$values = backdrop_json_decode($this->backdropPost('form-test/no-access-h5date-h5time', array(), 'Submit'));
// If the value callback html_date_or_time_value_callback() did its job
// correctly, we'll get strings.
$this->assertEqual($values['no_access_h5date'], '2023-01-01', 'Correct no_access_h5date value');
$this->assertEqual($values['no_access_h5time'], '20:30', 'Correct no_access_h5time value');
$this->assertEqual($values['disabled_h5date'], '2023-01-01', 'Correct disabled_h5date value');
$this->assertEqual($values['disabled_h5time'], '20:30', 'Correct disabled_h5time value');
}