WebformWizardLinksTest.php in Webform 8.5
File
tests/src/Functional/Wizard/WebformWizardLinksTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional\Wizard;
use Drupal\webform\Entity\Webform;
class WebformWizardLinksTest extends WebformWizardTestBase {
protected static $testWebforms = [
'test_form_wizard_links',
];
public function testWizardLinks() {
$this
->drupalLogin($this->rootUser);
$wizard_webform = Webform::load('test_form_wizard_links');
$this
->drupalGet('/webform/test_form_wizard_links');
$this
->assertCssSelect('.webform-wizard-pages-links');
$this
->assertNoFieldByName('webform_wizard_page-page_1', 'Edit');
$this
->assertNoFieldByName('webform_wizard_page-page_2', 'Edit');
$this
->drupalPostForm('/webform/test_form_wizard_links', [], 'Next >');
$this
->assertCssSelect('.webform-wizard-pages-links');
$this
->assertFieldByName('webform_wizard_page-page_1', 'Edit');
$this
->assertNoFieldByName('webform_wizard_page-page_2', 'Edit');
$this
->drupalPostForm('/webform/test_form_wizard_links', [], 'Preview');
$this
->assertCssSelect('.webform-wizard-pages-links');
$this
->assertFieldByName('webform_wizard_page-page_1', 'Edit');
$this
->assertFieldByName('webform_wizard_page-page_2', 'Edit');
$this
->assertNoCssSelect('.webform-wizard-pages-links.form-actions');
$this
->assertCssSelect('.webform-wizard-pages-links[data-wizard-progress-link="true"]');
$this
->assertCssSelect('.webform-wizard-pages-links[data-wizard-preview-link="true"]');
$wizard_webform
->setSetting('wizard_preview_link', FALSE)
->save();
$this
->drupalGet('/webform/test_form_wizard_links');
$this
->assertCssSelect('.webform-wizard-pages-links[data-wizard-progress-link="true"]');
$this
->assertNoCssSelect('.webform-wizard-pages-links[data-wizard-preview-link="true"]');
$wizard_webform
->setSetting('wizard_progress_link', FALSE)
->setSetting('wizard_preview_link', TRUE)
->save();
$this
->drupalGet('/webform/test_form_wizard_links');
$this
->assertNoCssSelect('.webform-wizard-pages-links[data-wizard-progress-link="true"]');
$this
->assertCssSelect('.webform-wizard-pages-links[data-wizard-preview-link="true"]');
$wizard_webform
->setSetting('wizard_progress_link', FALSE)
->setSetting('wizard_preview_link', FALSE)
->save();
$this
->drupalGet('/webform/test_form_wizard_links');
$this
->assertNoCssSelect('.webform-wizard-pages-links');
}
}