WebformElementSubmittedValueTest.php in Webform 8.5
File
tests/src/Functional/Element/WebformElementSubmittedValueTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Element;
use Drupal\webform\Entity\Webform;
class WebformElementSubmittedValueTest extends WebformElementBrowserTestBase {
protected static $testWebforms = [
'test_element_submitted_value',
];
public function testSubmittedValue() {
$this
->drupalLogin($this->rootUser);
$webform = Webform::load('test_element_submitted_value');
$sid = $this
->postSubmission($webform);
$this
->drupalGet("/webform/test_element_submission_value/submissions/{$sid}/edit");
$this
->assertRaw('<option value="three" selected="selected">Three</option>');
$this
->assertOptionSelected('edit-select', 'three');
$this
->assertOptionSelected('edit-select-multiple', 'three');
$this
->assertFieldChecked('edit-checkboxes-three');
$elements = $webform
->getElementsDecoded();
foreach ($elements as &$element) {
unset($element['#options']['three']);
}
$webform
->setElements($elements);
$webform
->save();
$this
->drupalGet("/webform/test_element_submission_value/submissions/{$sid}/edit");
$this
->assertNoRaw('<option value="three" selected="selected">Three</option>');
$this
->assertRaw('<option value="three" selected="selected">three</option>');
$this
->assertOptionSelected('edit-select', 'three');
$this
->assertOptionSelected('edit-select-multiple', 'three');
$this
->assertFieldChecked('edit-checkboxes-three');
}
}