SiteContactFormTest.php in Lightning Core 8.5
File
modules/lightning_contact_form/tests/src/Functional/SiteContactFormTest.php
View source
<?php
namespace Drupal\Tests\lightning_contact_form\Functional;
use Drupal\Tests\BrowserTestBase;
class SiteContactFormTest extends BrowserTestBase {
protected static $modules = [
'lightning_contact_form',
];
protected $defaultTheme = 'stark';
public function test() {
$assert_session = $this
->assertSession();
$this
->drupalGet('/contact/sitewide');
$assert_session
->statusCodeEquals(200);
$assert_session
->fieldExists('Your name');
$assert_session
->fieldExists('Your email address');
$assert_session
->fieldExists('Subject');
$assert_session
->fieldExists('Message');
$account = $this
->drupalCreateUser();
$this
->drupalLogin($account);
$this
->drupalGet('/contact/sitewide');
$assert_session
->statusCodeEquals(200);
$assert_session
->fieldNotExists('Your name');
$assert_session
->fieldNotExists('Your email address');
$assert_session
->fieldExists('Subject');
$assert_session
->fieldExists('Message');
$this
->drupalLogout();
}
}