public function WebformVariantExcludedTest::testVariantExcluded in Webform 8.5
Same name and namespace in other branches
- 6.x tests/src/Functional/Variant/WebformVariantExcludedTest.php \Drupal\Tests\webform\Functional\Variant\WebformVariantExcludedTest::testVariantExcluded()
Test variant element.
File
- tests/
src/ Functional/ Variant/ WebformVariantExcludedTest.php, line 31
Class
- WebformVariantExcludedTest
- Tests for the webform variant excluded.
Namespace
Drupal\Tests\webform\Functional\VariantCode
public function testVariantExcluded() {
$this
->drupalLogin($this->rootUser);
// Check that the test variant plugin is available to 'test_variant_*'
// webforms.
$this
->drupalGet('/admin/structure/webform/manage/test_variant_multiple/element/add/webform_variant');
$this
->assertRaw('<option value="override">Override</option>');
$this
->assertRaw('<option value="test">Test</option>');
// Exclude the test variant plugin.
\Drupal::configFactory()
->getEditable('webform.settings')
->set('variant.excluded_variants', [
'test' => 'test',
])
->save();
// Check that the test variant plugin is now excluded.
$this
->drupalGet('/admin/structure/webform/manage/test_variant_multiple/element/add/webform_variant');
$this
->assertRaw('<option value="override">Override</option>');
$this
->assertNoRaw('<option value="test">Test</option>');
}