WebformWizardAccessTest.php in Webform 8.5
File
tests/src/Functional/Wizard/WebformWizardAccessTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Wizard;
use Drupal\webform\Entity\Webform;
class WebformWizardAccessTest extends WebformWizardTestBase {
protected static $testWebforms = [
'test_form_wizard_access',
];
public function testConditionalWizard() {
$webform = Webform::load('test_form_wizard_access');
$this
->drupalGet('/webform/test_form_wizard_access');
$this
->assertRaw('<b>All</b>');
$this
->assertRaw('<b>Anonymous</b>');
$this
->assertNoRaw('<b>Authenticated</b>');
$this
->assertNoRaw('<b>Private</b>');
$this
->drupalPostForm('/webform/test_form_wizard_access', [], 'Next >');
$this
->drupalPostForm(NULL, [], 'Submit');
$sid = $this
->getLastSubmissionId($webform);
$this
->drupalGet("webform/test_form_wizard_access/submissions/{$sid}");
$this
->assertRaw('test_form_wizard_access--page_all');
$this
->assertRaw('test_form_wizard_access--page_anonymous');
$this
->assertNoRaw('test_form_wizard_access--page_authenticated');
$this
->assertNoRaw('test_form_wizard_access--page_private');
$this
->drupalGet("webform/test_form_wizard_access/submissions/{$sid}/edit");
$this
->assertRaw('<b>All</b>');
$this
->assertRaw('<b>Anonymous</b>');
$this
->assertNoRaw('<b>Authenticated</b>');
$this
->assertNoRaw('<b>Private</b>');
$this
->drupalLogin($this->rootUser);
$this
->drupalGet('/webform/test_form_wizard_access');
$this
->assertRaw('<b>All</b>');
$this
->assertNoRaw('<b>Anonymous</b>');
$this
->assertRaw('<b>Authenticated</b>');
$this
->assertRaw('<b>Private</b>');
$this
->drupalPostForm('/webform/test_form_wizard_access', [], 'Next >');
$this
->drupalPostForm(NULL, [], 'Next >');
$this
->drupalPostForm(NULL, [], 'Submit');
$sid = $this
->getLastSubmissionId($webform);
$this
->drupalGet("webform/test_form_wizard_access/submissions/{$sid}");
$this
->assertRaw('test_form_wizard_access--page_all');
$this
->assertNoRaw('test_form_wizard_access--page_anonymous');
$this
->assertRaw('test_form_wizard_access--page_authenticated');
$this
->assertRaw('test_form_wizard_access--page_private');
$this
->drupalGet("webform/test_form_wizard_access/submissions/{$sid}/edit");
$this
->assertRaw('<b>All</b>');
$this
->assertNoRaw('<b>Anonymous</b>');
$this
->assertRaw('<b>Authenticated</b>');
$this
->assertRaw('<b>Private</b>');
}
}