You are here

protected function WebformMigrateAssertionsTrait::assertWebformSubmission7Values in Webform: Migrate 8

Same name and namespace in other branches
  1. 8.2 tests/src/Traits/WebformMigrateAssertionsTrait.php \Drupal\Tests\webform_migrate\Traits\WebformMigrateAssertionsTrait::assertWebformSubmission7Values()

Assertions of the webform_submission 7 content entity.

1 call to WebformMigrateAssertionsTrait::assertWebformSubmission7Values()
WebformMigrateTest::testWebformMigrations in tests/src/Kernel/Migrate/d7/WebformMigrateTest.php
Tests the migration of webforms and webform submissions.

File

tests/src/Traits/WebformMigrateAssertionsTrait.php, line 658

Class

WebformMigrateAssertionsTrait
Trait for webform migration tests.

Namespace

Drupal\Tests\webform_migrate\Traits

Code

protected function assertWebformSubmission7Values() {
  $webform_submission = $this->container
    ->get('entity_type.manager')
    ->getStorage('webform_submission')
    ->load(7);
  assert($webform_submission instanceof WebformSubmissionInterface);
  $this
    ->assertEquals([
    'uid' => [
      [
        'target_id' => 3,
      ],
    ],
    'created' => [
      [
        'value' => 1600327527,
      ],
    ],
    'serial' => [
      [
        'value' => 4,
      ],
    ],
    'sid' => [
      [
        'value' => 7,
      ],
    ],
    'uri' => [
      [
        'value' => '/node/3',
      ],
    ],
    'completed' => [
      [
        'value' => 1600327527,
      ],
    ],
    'in_draft' => [
      [
        'value' => 0,
      ],
    ],
    'current_page' => [],
    'remote_addr' => [
      [
        'value' => '172.16.0.166',
      ],
    ],
    'webform_id' => [
      [
        'target_id' => 'webform_3',
      ],
    ],
    'entity_type' => [
      [
        'value' => 'node',
      ],
    ],
    'entity_id' => [
      [
        'value' => 3,
      ],
    ],
    'locked' => [
      [
        'value' => 0,
      ],
    ],
    'sticky' => [
      [
        'value' => 0,
      ],
    ],
    'notes' => [],
  ], $this
    ->getImportantEntityProperties($webform_submission));

  // Webform submission data.
  $this
    ->assertEquals([
    'checkboxes' => [
      'AQ',
      'AW',
    ],
    'date' => '2020-01-23',
    'email' => 'user@drupal7-webform.localhost',
    'number' => '45',
    'radios' => 'wednesday',
    'textarea' => 'No file was attached.',
    'time' => '20:04:00',
    'title_as_textfield' => "User's submission",
  ], $webform_submission
    ->getData());
}