public function PrepopulateFormTest::allInputs in Prepopulate 8.2
Test values of prepopulate with all inputs.
Return value
array The test data.
1 call to PrepopulateFormTest::allInputs()
- PrepopulateFormTest::testAllPrepopulate in tests/
src/ Functional/ PrepopulateFormTest.php - Test pre-populating all values into a form. Safe and unsafe inputs.
File
- tests/
src/ Functional/ PrepopulateFormTest.php, line 134
Class
- PrepopulateFormTest
- Form functionality tests of prepopulate.
Namespace
Drupal\Tests\prepopulate\FunctionalCode
public function allInputs() {
$data['checkboxes'] = [
'uri' => 'edit[checkboxes][green]=true',
'expected' => 'checkboxes: array ( \'green\' => \'green\', \'black\' => 0, \'blue\' => 0, \'red\' => 0, \'white\' => 0, \'yellow\' => 0, )',
];
$data['date'] = [
'uri' => 'edit[date]=1970-01-01',
'expected' => 'date: \'1970-01-01\'',
];
$data['datelist'] = [
'uri' => 'edit[datelist][year]=1970&edit[datelist][month]=1&edit[datelist][day]=1&edit[datelist][hour]=12&edit[datelist][minute]=59',
'expected' => 'datelist: 1970-01-01 12:59:00',
];
$data['datetime'] = [
'uri' => 'edit[datetime][date]=1970-01-01&edit[datetime][time]=16:30:00',
'expected' => 'datetime: 1970-01-01 16:30:00',
];
$data['entity_autocomplete'] = [
'uri' => 'edit[entity_autocomplete]=1',
'expected' => 'entity_autocomplete: \'1\'',
];
$data['entity_autocreate'] = [
'uri' => 'edit[entity_autocreate]=Apples',
'expected' => 'entity_autocreate: Apples (1)',
];
$data['email'] = [
'uri' => 'edit[email]=example%40example.com',
'expected' => 'email: \'example@example.com\'',
];
$data['machine_name'] = [
'uri' => 'edit[machine_name]=non_existent_view',
'expected' => 'machine_name: \'non_existent_view\'',
];
$data['number'] = [
'uri' => 'edit[number]=123',
'expected' => 'number: \'123\'',
];
$data['path'] = [
'uri' => 'edit[path]=node/1',
'expected' => 'path: array ( \'route_name\' => \'entity.node.canonical\', \'route_parameters\' => array ( \'node\' => \'1\', ), )',
];
$data['radios'] = [
'uri' => 'edit[radios][north america]=north america',
'expected' => 'radios: \'north america\'',
];
$data['telephone'] = [
'uri' => 'edit[telephone]=555-555-5555',
'expected' => 'telephone: \'555-555-5555\'',
];
$data['textarea'] = [
'uri' => 'edit[textarea]=hello world',
'expected' => 'textarea: \'hello world\'',
];
$data['textfield'] = [
'uri' => 'edit[textfield]=foo bar',
'expected' => 'textfield: \'foo bar\'',
];
$data['select'] = [
'uri' => 'edit[select]=east',
'expected' => 'select: \'east\'',
];
$data['url'] = [
'uri' => 'edit[url]=http://www.example.com',
'expected' => 'url: \'http://www.example.com\'',
];
return $data;
}