public function FieldRedirectionResultBuilderLinkTest::providerTestFieldRedirectionResultBuilder in Field Redirection 8.2
Data provider for ::testFieldRedirectionResultBuilderDenyStates().
Return value
array Test cases.
File
- tests/
src/ Kernel/ FieldRedirectionResultBuilderLinkTest.php, line 123
Class
- FieldRedirectionResultBuilderLinkTest
- Defines a class for testing field redirection result builder for link fields.
Namespace
Drupal\Tests\field_redirection\KernelCode
public function providerTestFieldRedirectionResultBuilder() {
$default_field_values = [
'field_redirect_link' => [
'uri' => 'http://example.com',
],
];
$request = Request::create('/');
return [
'non matching page, exclude' => [
$default_field_values,
[],
'/user',
'user.page',
[
'page_restrictions' => '2',
'pages' => '/user',
],
],
'non matching page, include' => [
$default_field_values,
[],
'/user',
'user.page',
[
'page_restrictions' => '1',
'pages' => '/node',
],
],
'non matching page, include w/ tokens' => [
$default_field_values,
[],
'/user',
'user.page',
[
'page_restrictions' => '1',
'pages' => '/[site:name]',
],
],
'non matching page, exclude w/ tokens' => [
$default_field_values,
[],
'/field-redirection-test',
'<front>',
[
'page_restrictions' => '2',
'pages' => '/[site:name]',
],
],
'cron run from external' => [
$default_field_values,
[],
'/cron/1231234',
'system.cron',
[],
],
'manual cron run' => [
$default_field_values,
[],
'/admin/reports/status/run-cron',
'system.run_cron',
[],
],
'empty field, not 404 on empty' => [
[],
[],
'/user',
'user.page',
[
'404_if_empty' => FALSE,
],
],
'empty field, 404 on empty, but bypass permission' => [
[],
[
'bypass redirection',
],
'/user',
'user.page',
[
'404_if_empty' => TRUE,
],
],
'same page as current page' => [
[
'field_redirect_link' => [
'uri' => 'internal:/user',
],
],
],
'same page as current page, absolute' => [
[
'field_redirect_link' => [
'uri' => $request
->getSchemeAndHttpHost() . $request
->getBasePath() . '/user',
],
],
],
];
}