public function UrlRedirectNegateTest::setUp in Url Redirect 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/UrlRedirectNegateTest.php \Drupal\Tests\url_redirect\Functional\UrlRedirectNegateTest::setUp()
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ UrlRedirectNegateTest.php, line 78
Class
- UrlRedirectNegateTest
- Tests the negation option for user and role redirect condition.
Namespace
Drupal\Tests\url_redirect\FunctionalCode
public function setUp() {
parent::setUp();
// Create roles.
$this->ridOne = $this
->drupalCreateRole(array(), 'custom_role_1', 'custom_role_1');
$this->ridTwo = $this
->drupalCreateRole(array(), 'custom_role_2', 'custom_role_2');
// Create user with role one.
$this->userOne = $this
->drupalCreateUser();
$this->userOne
->addRole($this->ridOne);
$this->userOne
->save();
$this->userTwo = $this
->drupalCreateUser();
$this->userTwo
->addRole($this->ridTwo);
$this->userTwo
->save();
// Create a node for source path and one for redirection path.
$this
->drupalCreateContentType(array(
'type' => 'page',
'name' => 'Basic page',
));
$permissions = array(
'create page content',
'access content',
'access url redirect settings page',
'access url redirect edit page',
);
$this->adminUser = $this
->drupalCreateUser($permissions);
$sourceNode = $this
->drupalCreateNode(array(
'type' => 'page',
'uid' => $this->adminUser
->id(),
));
$destNode = $this
->drupalCreateNode(array(
'type' => 'page',
'uid' => $this->adminUser
->id(),
));
$this->sourcePath = "/node/" . $sourceNode
->id();
$this->destPath = "/node/" . $destNode
->id();
}