function AjaxPageStateTest::providerHandle

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/StackMiddleware/AjaxPageStateTest.php \Drupal\Tests\Core\StackMiddleware\AjaxPageStateTest::providerHandle()

Provides data for testHandle().

File

core/tests/Drupal/Tests/Core/StackMiddleware/AjaxPageStateTest.php, line 63

Class

AjaxPageStateTest
Tests Drupal\Core\StackMiddleware\AjaxPageState.

Namespace

Drupal\Tests\Core\StackMiddleware

Code

public static function providerHandle() : array {
  $foo_bar = UrlHelper::compressQueryParameter('core/foo,core/bar');
  $foo_baz = UrlHelper::compressQueryParameter('core/foo,core/baz');
  $data = [];
  $data['only query'] = [
    $foo_bar,
    NULL,
    'core/foo,core/bar',
    NULL,
  ];
  $data['only request'] = [
    NULL,
    $foo_bar,
    NULL,
    'core/foo,core/bar',
  ];
  $data['matching'] = [
    $foo_bar,
    $foo_bar,
    'core/foo,core/bar',
    'core/foo,core/bar',
  ];
  $data['different'] = [
    $foo_baz,
    $foo_bar,
    'core/foo,core/bar,core/baz',
    'core/foo,core/bar,core/baz',
  ];
  $data['invalid libraries discarded'] = [
    UrlHelper::compressQueryParameter('<b>foo'),
    NULL,
    NULL,
    NULL,
  ];
  $data['mixed valid and invalid'] = [
    UrlHelper::compressQueryParameter('core/drupal,<b>foo'),
    NULL,
    'core/drupal',
    NULL,
  ];
  // A name containing a slash is structurally valid; the middleware does not
  // need to filter it because the asset system ignores unknown libraries.
  $data['slash-containing name preserved'] = [
    UrlHelper::compressQueryParameter('core/<b>foo'),
    NULL,
    'core/<b>foo',
    NULL,
  ];
  return $data;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.