WebformVariantExcludedTest.php in Webform 8.5
File
tests/src/Functional/Variant/WebformVariantExcludedTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Variant;
use Drupal\Tests\webform\Functional\WebformBrowserTestBase;
class WebformVariantExcludedTest extends WebformBrowserTestBase {
public static $modules = [
'webform',
'webform_ui',
'webform_test_variant',
];
protected static $testWebforms = [
'test_variant_multiple',
];
public function testVariantExcluded() {
$this
->drupalLogin($this->rootUser);
$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>');
\Drupal::configFactory()
->getEditable('webform.settings')
->set('variant.excluded_variants', [
'test' => 'test',
])
->save();
$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>');
}
}