You are here

public function PathContextTest::providerTestPopulateHtmlHeadIdentities in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/Service/Context/PathContextTest.php \Drupal\Tests\acquia_lift\Unit\Service\Context\PathContextTest::providerTestPopulateHtmlHeadIdentities()

Data provider for testPopulateHtmlHeadIdentities().

File

tests/src/Unit/Service/Context/PathContextTest.php, line 211

Class

PathContextTest
PathContextTest Test.

Namespace

Drupal\Tests\acquia_lift\Unit\Service\Context

Code

public function providerTestPopulateHtmlHeadIdentities() {
  $no_query_parameter_string = '';
  $full_query_parameter_string = 'my_identity_parameter=query_identity&my_identity_type_parameter=query_identity_type&other=other';
  $partial_query_parameter_string = 'my_identity_parameter=query_identity&other=other';
  $no_capture_identity = FALSE;
  $do_capture_identity = TRUE;
  $no_set_user = FALSE;
  $do_set_user = TRUE;
  $expect_cache_identity_and_identity_type = [
    'url.query_args:my_identity_parameter',
    'url.query_args:my_identity_type_parameter',
  ];
  $expect_html_head_empty = NULL;
  $expect_identity_of_full_query_string = [
    [
      [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'itemprop' => 'acquia_lift:identity:query_identity_type',
          'content' => 'query_identity',
        ],
      ],
      'identity:query_identity_type',
    ],
  ];
  $expect_identity_of_partial_query_string = [
    [
      [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'itemprop' => 'acquia_lift:identity:my_default_identity_type',
          'content' => 'query_identity',
        ],
      ],
      'identity:my_default_identity_type',
    ],
  ];
  $expect_identity_of_user = [
    [
      [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'itemprop' => 'acquia_lift:identity:email',
          'content' => 'a_user_email',
        ],
      ],
      'identity:email',
    ],
  ];
  $expect_identity_of_full_query_string_and_user = array_merge($expect_identity_of_full_query_string, $expect_identity_of_user);
  $data['no query, no capture, no user'] = [
    $no_query_parameter_string,
    $no_capture_identity,
    $no_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_html_head_empty,
  ];
  $data['no query, no capture, yes user'] = [
    $no_query_parameter_string,
    $no_capture_identity,
    $do_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_html_head_empty,
  ];
  $data['no query, do capture, yes user'] = [
    $no_query_parameter_string,
    $do_capture_identity,
    $do_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_identity_of_user,
  ];
  $data['yes query, no capture, no user'] = [
    $full_query_parameter_string,
    $no_capture_identity,
    $no_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_identity_of_full_query_string,
  ];
  $data['yes query (but partial), no capture, no user'] = [
    $partial_query_parameter_string,
    $no_capture_identity,
    $no_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_identity_of_partial_query_string,
  ];
  $data['yes query, no capture, yes user'] = [
    $full_query_parameter_string,
    $no_capture_identity,
    $do_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_identity_of_full_query_string,
  ];
  $data['yes query, do capture, yes user'] = [
    $full_query_parameter_string,
    $do_capture_identity,
    $do_set_user,
    $expect_cache_identity_and_identity_type,
    $expect_identity_of_full_query_string_and_user,
  ];
  return $data;
}