private function UrlRedirectNegateTest::addUrlRedirect in Url Redirect 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/UrlRedirectNegateTest.php \Drupal\Tests\url_redirect\Functional\UrlRedirectNegateTest::addUrlRedirect()
Create a redirect.
Parameters
string $path: Redirection source path.
string $redirect_path: Path to redirect to.
string $check_for: Value to check for. Role or User
array $check_value: Array of values that should be checked for.
string $negate: 1 to enable negate, 0 to disable.
string $message: Determine if message should display or not.
string $status: Determine if redirection is enabled or not.
2 calls to UrlRedirectNegateTest::addUrlRedirect()
- UrlRedirectNegateTest::testRoleNegation in tests/
src/ Functional/ UrlRedirectNegateTest.php - UrlRedirectNegateTest::testUserNegation in tests/
src/ Functional/ UrlRedirectNegateTest.php
File
- tests/
src/ Functional/ UrlRedirectNegateTest.php, line 156
Class
- UrlRedirectNegateTest
- Tests the negation option for user and role redirect condition.
Namespace
Drupal\Tests\url_redirect\FunctionalCode
private function addUrlRedirect($path, $redirect_path, $check_for, $check_value, $negate, $message, $status) {
$formValues = [];
$formValues['path'] = $path;
$formValues['redirect_path'] = $redirect_path;
$formValues['checked_for'] = $check_for;
$formValues['negate'] = $negate;
$formValues['message'] = $message;
$formValues['status'] = $status;
if ($check_for === 'User') {
$formValues['user'] = implode(',', $check_value);
}
else {
$formValues['roles[]'] = $check_value;
}
$this
->drupalPostForm('admin/config/system/url_redirect/add', $formValues, t('Save'));
}