You are here

public function QueryStringWebformSourceEntityTest::providerGetCurrentSourceEntity in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Unit/Plugin/WebformSourceEntity/QueryStringWebformSourceEntityTest.php \Drupal\Tests\webform\Unit\Plugin\WebformSourceEntity\QueryStringWebformSourceEntityTest::providerGetCurrentSourceEntity()

Data provider for testGetCurrentSourceEntity().

See also

testGetCurrentSourceEntity()

File

tests/src/Unit/Plugin/WebformSourceEntity/QueryStringWebformSourceEntityTest.php, line 229

Class

QueryStringWebformSourceEntityTest
Tests the "query_string" webform source entity plugin.

Namespace

Drupal\Tests\webform\Unit\Plugin\WebformSourceEntity

Code

public function providerGetCurrentSourceEntity() {
  $tests[] = [
    [
      'source_entity_has_translation' => FALSE,
      'route_match_get_parameter_webform' => FALSE,
    ],
    FALSE,
    'No webform in route',
  ];
  $tests[] = [
    [
      'source_entity_has_translation' => FALSE,
      'request_query_source_entity_type' => 'user',
    ],
    FALSE,
    'Inexisting entity type in query string',
  ];
  $tests[] = [
    [
      'source_entity_view_access_result' => FALSE,
      'source_entity_has_translation' => FALSE,
    ],
    FALSE,
    'Source entity without "view" access',
  ];
  $tests[] = [
    [
      'source_entity_view_access_result' => FALSE,
    ],
    FALSE,
    'Source entity translated without "view" access',
  ];
  $tests[] = [
    [
      'source_entity_has_translation' => FALSE,
    ],
    TRUE,
    'Prepopulating of webform source entity is allowed',
  ];
  $tests[] = [
    [
      'source_entity_has_translation' => FALSE,
      'ignored_types' => [
        'node',
      ],
    ],
    TRUE,
    'Ignored_types is not considered by query string plugin.',
  ];
  $tests[] = [
    [
      'webform_settings_prepopulate_source_entity' => FALSE,
      'source_entity_has_translation' => FALSE,
    ],
    TRUE,
    'Source entity references webform',
  ];
  $tests[] = [
    [
      'webform_settings_prepopulate_source_entity' => FALSE,
    ],
    TRUE,
    'Translation of source entity references webform',
  ];
  $tests[] = [
    [
      'webform_settings_prepopulate_source_entity' => FALSE,
      'source_entity_has_webform_field' => FALSE,
      'source_entity_has_translation' => FALSE,
    ],
    FALSE,
    'Source entity does not reference webform',
  ];
  $tests[] = [
    [
      'webform_settings_prepopulate_source_entity' => FALSE,
      'source_entity_has_webform_field' => FALSE,
    ],
    FALSE,
    'Translation of source entity does not reference webform',
  ];
  return $tests;
}