View source
<?php
namespace Drupal\Tests\webform\Functional\Wizard;
class WebformWizardCustomTest extends WebformWizardTestBase {
public static $modules = [
'webform',
'webform_test_wizard_custom',
];
protected static $testWebforms = [
'test_form_wizard_custom',
];
public function testCustomWizard() {
$this
->drupalGet('/webform/test_form_wizard_custom');
$this
->assertCurrentPage('Wizard page #1', 'wizard_1');
$this
->drupalPostForm('/webform/test_form_wizard_custom', [], 'Next >');
$this
->assertCurrentPage('Wizard page #2', 'wizard_2');
$this
->drupalPostForm(NULL, [], '< Previous');
$this
->assertCurrentPage('Wizard page #1', 'wizard_1');
$edit = [
'pages[wizard_1]' => TRUE,
'pages[wizard_2]' => TRUE,
'pages[wizard_3]' => FALSE,
'pages[wizard_4]' => FALSE,
'pages[wizard_5]' => TRUE,
'pages[wizard_6]' => TRUE,
'pages[wizard_7]' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Next >');
$this
->assertCurrentPage('Wizard page #2', 'wizard_2');
$this
->drupalPostForm(NULL, [], 'Next >');
$this
->assertCurrentPage('Wizard page #5', 'wizard_5');
$this
->drupalPostForm(NULL, [], '< Previous');
$this
->assertCurrentPage('Wizard page #2', 'wizard_2');
$this
->drupalPostForm(NULL, [], '< Previous');
$this
->assertCurrentPage('Wizard page #1', 'wizard_1');
}
}