AntibotNoJavascriptTest.php in Antibot 8
File
tests/src/Functional/AntibotNoJavascriptTest.php
View source
<?php
namespace Drupal\Tests\antibot\Functional;
use Drupal\Tests\BrowserTestBase;
class AntibotNoJavascriptTest extends BrowserTestBase {
protected static $modules = [
'antibot',
];
protected $defaultTheme = 'stark';
public function testNoJavaScript() {
$this
->drupalPostForm('/user/password', [
'name' => $this
->randomMachineName(),
], 'Submit');
$this
->assertUrl('/antibot');
$this
->assertSession()
->pageTextContains('Submission failed');
$this
->assertSession()
->pageTextContains('You have reached this page because you submitted a form that required JavaScript to be enabled on your browser. This protection is in place to attempt to prevent automated submissions made on forms. Please return to the page that you came from and enable JavaScript on your browser before attempting to submit the form again.');
}
}