public function UrlRedirectNegateTest::testUserNegation in Url Redirect 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/UrlRedirectNegateTest.php \Drupal\Tests\url_redirect\Functional\UrlRedirectNegateTest::testUserNegation()
File
- tests/
src/ Functional/ UrlRedirectNegateTest.php, line 127
Class
- UrlRedirectNegateTest
- Tests the negation option for user and role redirect condition.
Namespace
Drupal\Tests\url_redirect\FunctionalCode
public function testUserNegation() {
// Add User redirect with negation.
$this
->drupalLogin($this->adminUser);
$this
->addUrlRedirect($this->sourcePath, $this->destPath, 'User', [
$this->userOne
->getAccountName(),
], '1', 'No', '1');
// Confirm user one is not redirected.
$this
->drupalLogin($this->userOne);
$this
->drupalGet($this->sourcePath);
$this
->assertSession()
->addressNotEquals($this->destPath);
// Confirm user two is redirected.
$this
->drupalLogin($this->userTwo);
$this
->drupalGet($this->sourcePath);
$this
->assertSession()
->addressNotEquals($this->destPath);
}