WebformNodeVariantTest.php in Webform 8.5
File
modules/webform_node/tests/src/Functional/WebformNodeVariantTest.php
View source
<?php
namespace Drupal\Tests\webform_node\Functional;
use Drupal\webform\Entity\WebformSubmission;
class WebformNodeVariantTest extends WebformNodeBrowserTestBase {
public static $modules = [
'webform',
'webform_node',
];
protected static $testWebforms = [
'test_variant_multiple',
];
public function testNodeVariant() {
$node = $this
->createWebformNode('test_variant_multiple');
$node->webform->default_data = "letter: a\nnumber: '1'";
$node
->save();
$this
->drupalLogin($this->rootUser);
$this
->drupalGet('/node/' . $node
->id());
$this
->assertRaw('[A]');
$this
->assertRaw('[1]');
$sid = $this
->postNodeSubmission($node);
$webform_submission = WebformSubmission::load($sid);
$this
->assertEquals([
'letter' => 'a',
'number' => '1',
], $webform_submission
->getData());
$sid = $this
->postNodeSubmissionTest($node);
$webform_submission = WebformSubmission::load($sid);
$this
->assertEquals([
'letter' => 'a',
'number' => '1',
], $webform_submission
->getData());
}
}