WebformSettingsAssetsTest.php in Webform 8.5
File
tests/src/Functional/Settings/WebformSettingsAssetsTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Settings;
use Drupal\webform\Entity\Webform;
use Drupal\Tests\webform\Functional\WebformBrowserTestBase;
class WebformSettingsAssetsTest extends WebformBrowserTestBase {
protected static $testWebforms = [
'test_form_assets',
];
public function testAssets() {
$webform_assets = Webform::load('test_form_assets');
$this
->drupalGet('/webform/test_form_assets');
$this
->assertRaw('href="' . base_path() . 'webform/css/test_form_assets?');
$this
->assertRaw('src="' . base_path() . 'webform/javascript/test_form_assets?');
$webform_assets
->setCss('')
->setJavaScript('')
->save();
$this
->drupalGet('/webform/test_form_assets');
$this
->assertNoRaw('href="' . base_path() . 'webform/css/test_form_assets?');
$this
->assertNoRaw('src="' . base_path() . 'webform/javascript/test_form_assets?');
\Drupal::configFactory()
->getEditable('webform.settings')
->set('assets.css', '/**/')
->set('assets.javascript', '/**/')
->save();
$this
->drupalGet('/webform/test_form_assets');
$this
->assertRaw('href="' . base_path() . 'webform/css/test_form_assets?');
$this
->assertRaw('src="' . base_path() . 'webform/javascript/test_form_assets?');
}
}