AdminSettingsTest.php in Sparkpost email 8.2
File
modules/sparkpost_requeue/tests/src/Functional/AdminSettingsTest.php
View source
<?php
namespace Drupal\Tests\sparkpost_requeue\Functional;
use Drupal\Tests\BrowserTestBase;
class AdminSettingsTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'sparkpost',
'sparkpost_requeue',
];
protected $user;
protected $admin;
public function setUp() : void {
parent::setUp();
$this->user = $this
->drupalCreateUser();
$this->admin = $this
->drupalCreateUser([
'access administration pages',
]);
}
public function testAdminAccess() {
$this
->drupalLogin($this->user);
$this
->drupalGet('admin/config/services/sparkpost_requeue');
$this
->assertSession()
->statusCodeEquals(403);
$this
->drupalLogout();
$this
->drupalLogin($this->admin);
$this
->drupalGet('admin/config/services/sparkpost_requeue');
$this
->assertSession()
->statusCodeEquals(200);
}
}