WebformElementSubmissionViewsReplaceTest.php in Webform 8.5
File
tests/src/Functional/Element/WebformElementSubmissionViewsReplaceTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Element;
class WebformElementSubmissionViewsReplaceTest extends WebformElementBrowserTestBase {
public static $modules = [
'views',
'node',
'webform',
'webform_node',
];
protected static $testWebforms = [
'test_element_submission_views_r',
];
public function testSubmissionViewsReplace() {
$this
->drupalGet('/webform/test_element_submission_views_r');
$this
->assertRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-global-global-routes" id="edit-webform-submission-views-replace-global-global-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->assertRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-global-webform-routes" id="edit-webform-submission-views-replace-global-webform-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->assertRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-global-node-routes" id="edit-webform-submission-views-replace-global-node-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->assertNoRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-webform-routes" id="edit-webform-submission-views-replace-webform-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->assertNoRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-node-routes" id="edit-webform-submission-views-replace-node-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->drupalPostForm('/webform/test_element_submission_views_r', [], 'Submit');
$this
->assertRaw("webform_submission_views_replace_global:\n global_routes:\n - entity.webform_submission.collection\n webform_routes:\n - entity.webform.results_submissions\n node_routes:\n - entity.node.webform.results_submissions\nwebform_submission_views_replace: { }");
\Drupal::configFactory()
->getEditable('webform.settings')
->set('settings.default_submission_views_replace', [
'global_routes' => [],
'webform_routes' => [],
'node_routes' => [],
])
->save();
$this
->drupalGet('/webform/test_element_submission_views_r');
$this
->assertRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-webform-routes" id="edit-webform-submission-views-replace-webform-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->assertRaw('<fieldset data-drupal-selector="edit-webform-submission-views-replace-node-routes" id="edit-webform-submission-views-replace-node-routes--wrapper" class="fieldgroup form-composite js-form-item form-item js-form-wrapper form-wrapper">');
$this
->drupalPostForm('/webform/test_element_submission_views_r', [], 'Submit');
$this
->assertRaw("webform_submission_views_replace_global:\n global_routes:\n - entity.webform_submission.collection\n webform_routes:\n - entity.webform.results_submissions\n node_routes:\n - entity.node.webform.results_submissions\nwebform_submission_views_replace:\n webform_routes:\n - entity.webform.results_submissions\n node_routes:\n - entity.node.webform.results_submissions");
}
}