public function WebformEncryptSubmissionStorageTest::testPreSaveHandlersAreCalledOnce in Webform Encrypt 8
Tests 'preSave' handlers are called only once.
File
- tests/
src/ Kernel/ WebformEncryptSubmissionStorageTest.php, line 132
Class
- WebformEncryptSubmissionStorageTest
- Tests webform submission storage.
Namespace
Drupal\Tests\webform_encrypt\KernelCode
public function testPreSaveHandlersAreCalledOnce() {
$this
->assertEquals(NULL, $this->container
->get('state')
->get('test_webform_handler_counter'));
$webform = Webform::load('test_encryption');
$values = [
'id' => 'webform_submission_test',
'webform_id' => $webform
->id(),
'data' => [
'test_text_field' => 'Test text field value',
'test_multiple_text_field' => [
0 => 'Test multiple text field value 1',
],
'test_text_area' => 'Test text area value',
'test_not_encrypted' => 'Test not encrypted value',
'test_address_field' => [
'address' => 'Test address field address',
'address_2' => 'Test address field address 2',
'city' => 'Test address field city',
'state_province' => 'California',
'postal_code' => 'AA11AA',
'country' => 'United Kingdom',
],
'test_multiple_address_field' => [
0 => [
'address' => 'Test multiple address field address',
'address_2' => 'Test multiple address field address 2',
'city' => 'Test multiple address field city',
'state_province' => 'California',
'postal_code' => 'AA11AA',
'country' => 'United Kingdom',
],
],
],
];
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = WebformSubmission::create($values);
$webform_submission
->save();
$this
->assertEquals(1, $this->container
->get('state')
->get('test_webform_handler_presave_counter'));
}