WebformBrowserTestBaseTest.php in Webform 8.5
File
tests/src/Functional/WebformBrowserTestBaseTest.php
View source
<?php
namespace Drupal\Tests\webform\Functional;
use Drupal\webform\Entity\Webform;
class WebformBrowserTestBaseTest extends WebformBrowserTestBase {
public static $modules = [
'webform',
'block',
'user',
];
protected static $testWebforms = [
'test_ajax',
];
protected function setUp() {
parent::setUp();
}
public function testWebformBase() {
$this
->assertNotNull(Webform::load('test_ajax'));
$test_webform = $this
->createWebform();
$this
->assertNotNull($test_webform);
$webform = Webform::load('contact');
$sid = $this
->postSubmission($webform);
$this
->assertFalse($sid);
$this
->drupalLogin($this->rootUser);
$sid = $this
->postSubmissionTest($webform);
$this
->assertNotNull($sid);
$webform_submission = $this
->loadSubmission($sid);
$this
->assertNotNull($webform_submission);
$this
->assertEquals('contact', $webform_submission
->getWebform()
->id());
$last_email = $this
->getLastEmail();
$this
->assertEquals('webform_contact_email_notification', $last_email['id']);
$this
->purgeSubmissions();
$webform_submission = $this
->loadSubmission($sid);
$this
->assertNull($webform_submission);
$this
->placeBlocks();
$this
->drupalGet('/webform/contact');
$this
->assertRaw('<h1>Contact</h1>');
$this
->assertRaw('<h2 id="system-breadcrumb" class="visually-hidden">Breadcrumb</h2>');
$this
->assertRaw('<h2 class="visually-hidden">Primary tabs</h2>');
}
}