ModerationDashboardRedirectTest.php in Moderation Dashboard 8
File
tests/src/Functional/ModerationDashboardRedirectTest.php
View source
<?php
namespace Drupal\Tests\moderation_dashboard\Functional;
class ModerationDashboardRedirectTest extends ModerationDashboardTestBase {
protected function setUp() {
parent::setUp();
$this
->config('system.site')
->set('page.403', '/user/login')
->save();
$this
->config('moderation_dashboard.settings')
->set('redirect_on_login', TRUE)
->save();
}
public function testRedirect() {
$this
->drupalGet('user/login');
$this
->submitForm([
'name' => $this->user
->getDisplayName(),
'pass' => $this->user->passRaw,
], t('Log in'));
$this
->assertSession()
->addressEquals("user/{$this->user->id()}/moderation/dashboard");
}
public function testNoRedirect() {
$this
->drupalGet('admin/content');
$this
->submitForm([
'name' => $this->user
->getDisplayName(),
'pass' => $this->user->passRaw,
], t('Log in'));
$this
->assertSession()
->addressEquals('admin/content');
}
}