PermissionTest.php in Create user permission 2.x
File
tests/src/Functional/PermissionTest.php
View source
<?php
namespace Drupal\Tests\create_user_permission\Functional;
use Drupal\Tests\BrowserTestBase;
class PermissionTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'create_user_permission',
];
public function testPermission() {
$create_user = $this
->drupalCreateUser([
'create users',
]);
$admin_user = $this
->drupalCreateUser([
'administer users',
]);
$this
->drupalLogin($admin_user);
$this
->drupalGet('admin/people/create');
$this
->assertSession()
->statusCodeEquals(403);
$this
->drupalLogout();
$this
->drupalLogin($create_user);
$this
->drupalGet('admin/people/create');
$this
->assertSession()
->statusCodeEquals(200);
}
}
Classes
Name |
Description |
PermissionTest |
Tests the JavaScript functionality of the Create user permission module. |