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