/**
* Tests the programmatic form submission workflow.
*/
public function testSubmissionWorkflow() { // Backup the current batch status and reset it to avoid conflicts while
// processing the dummy form submit handler.
$current_batch =
$batch =&
batch_get();
$batch =
[];
// Test that a programmatic form submission is rejected when a required
// textfield is omitted and correctly processed when it is provided.
$this->
doSubmitForm([], FALSE
);
$this->
doSubmitForm(['textfield' => 'test 1'
], TRUE
);
$this->
doSubmitForm([], FALSE
);
$this->
doSubmitForm(['textfield' => 'test 2'
], TRUE
);
// Test that a programmatic form submission can turn on and off checkboxes
// which are, by default, checked.
$this->
doSubmitForm(['textfield' => 'dummy value', 'checkboxes' =>
[1 => 1, 2 => 2
]], TRUE
);
$this->
doSubmitForm(['textfield' => 'dummy value', 'checkboxes' =>
[1 => 1, 2 => NULL
]], TRUE
);
$this->
doSubmitForm(['textfield' => 'dummy value', 'checkboxes' =>
[1 => NULL, 2 => 2
]], TRUE
);
$this->
doSubmitForm(['textfield' => 'dummy value', 'checkboxes' =>
[1 => NULL, 2 => NULL
]], TRUE
);