You are here

protected function ImporterTest::processForm in CSV Importer 8

Process form.

Parameters

string $entity_type: Entity type.

string|null $entity_type_bundle: Entity type bundle.

3 calls to ImporterTest::processForm()
ImporterTest::testNodeCsvImporter in tests/src/FunctionalJavascript/ImporterTest.php
Test node importer.
ImporterTest::testTaxonomyTermCsvImporter in tests/src/FunctionalJavascript/ImporterTest.php
Test taxonomy term importer.
ImporterTest::testUserCsvImporter in tests/src/FunctionalJavascript/ImporterTest.php
Test user importer.

File

tests/src/FunctionalJavascript/ImporterTest.php, line 109

Class

ImporterTest
Tests CSV importer.

Namespace

Drupal\Tests\csv_importer\FunctionalJavascript

Code

protected function processForm(string $entity_type, string $entity_type_bundle = NULL) {
  $assert = $this
    ->assertSession();
  $this
    ->drupalGet('admin/config/development/csv-importer');
  $assert
    ->statusCodeEquals(200);
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->selectFieldOption('entity_type', $entity_type);
  $assert
    ->assertWaitOnAjaxRequest();
  if ($entity_type_bundle) {
    $page
      ->selectFieldOption('entity_type_bundle', $entity_type_bundle);
  }
  $page
    ->attachFileToField('files[csv]', drupal_get_path('module', 'csv_importer_test') . "/content/csv_example_{$entity_type}_test.csv");
  $assert
    ->assertWaitOnAjaxRequest();
  $page
    ->pressButton('Import');
  $assert
    ->assertWaitOnAjaxRequest();
}