public function WebformEncryptSubmissionStorageTest::testAccessDecryptedDataPostSave in Webform Encrypt 8
Tests access to decrypted data after 'postSave'.
File
- tests/
src/ Kernel/ WebformEncryptSubmissionStorageTest.php, line 176
Class
- WebformEncryptSubmissionStorageTest
- Tests webform submission storage.
Namespace
Drupal\Tests\webform_encrypt\KernelCode
public function testAccessDecryptedDataPostSave() {
$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();
$data = $webform_submission
->getData();
$this
->assertEquals('Test text field value', $data['test_text_field']);
}