FloodUnblockUiPageTest.php in Flood Unblock 8.2
File
tests/src/Functional/FloodUnblockUiPageTest.php
View source
<?php
namespace Drupal\Tests\flood_unblock\Functional;
use Drupal\Tests\BrowserTestBase;
use Symfony\Component\HttpFoundation\Request;
class FloodUnblockUiPageTest extends BrowserTestBase {
protected static $modules = [
'flood_unblock',
];
private $admin_user;
private $simple_user;
public function setUp() {
parent::setUp();
$this->admin_user = $this
->drupalCreateUser([
'access flood unblock',
]);
$this->simple_user = $this
->drupalCreateUser();
$request = Request::createFromGlobals();
$this->container
->get('request_stack')
->push($request);
}
public function testFloodUnblockUiPageAdminUser() {
$this
->drupalLogin($this->admin_user);
$this
->drupalGet('admin/config/system/flood-unblock');
$this
->assertSession()
->statusCodeEquals(200, 'Status code is equal to 200');
$this
->assertSession()
->pageTextContains('There are no failed logins at this time.');
}
public function testFloodUnblockUiPageSimpleUser() {
$this
->drupalLogin($this->simple_user);
$this
->drupalGet('admin/config/system/flood-unblock');
$this
->assertSession()
->statusCodeEquals(403, 'Status code is equal to 403');
}
}