WebformUiElementPropertiesTest.php in Webform 8.5
File
modules/webform_ui/tests/src/Functional/WebformUiElementPropertiesTest.php
View source
<?php
namespace Drupal\Tests\webform_ui\Functional;
use Drupal\Tests\webform\Functional\WebformBrowserTestBase;
use Drupal\webform\Entity\Webform;
class WebformUiElementPropertiesTest extends WebformBrowserTestBase {
public static $modules = [
'filter',
'file',
'taxonomy',
'webform',
'webform_ui',
];
protected static $testWebforms = [
'example_style_guide',
'example_element_states',
'test_element',
'test_element_access',
'test_states_triggers',
'test_example_elements',
'test_example_elements_composite',
];
protected function setUp() {
parent::setUp();
$this
->createFilters();
}
public function testElementProperties() {
$this
->drupalLogin($this->rootUser);
foreach (static::$testWebforms as $webform_id) {
$webform_elements = Webform::load($webform_id);
$original_elements = $webform_elements
->getElementsDecodedAndFlattened();
foreach ($original_elements as $key => $original_element) {
$this
->drupalPostForm('/admin/structure/webform/manage/' . $webform_elements
->id() . '/element/' . $key . '/edit', [], 'Save');
\Drupal::entityTypeManager()
->getStorage('webform_submission')
->resetCache();
$webform_elements = Webform::load($webform_id);
$updated_element = $webform_elements
->getElementsDecodedAndFlattened()[$key];
$this
->assertEqual($original_element, $updated_element, "'{$key}'' properties is equal.");
}
}
}
}