function AcceptHeaderMatcherTest::acceptFilterProvider

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php \Drupal\Tests\Core\Routing\AcceptHeaderMatcherTest::acceptFilterProvider()
  2. 10 core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php \Drupal\Tests\Core\Routing\AcceptHeaderMatcherTest::acceptFilterProvider()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php \Drupal\Tests\Core\Routing\AcceptHeaderMatcherTest::acceptFilterProvider()

Provides data for the Accept header filtering test.

See also

Drupal\Tests\Core\Routing\AcceptHeaderMatcherTest::testAcceptFiltering()

File

core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php, line 46

Class

AcceptHeaderMatcherTest
Confirm that the mime types partial matcher is functioning properly.

Namespace

Drupal\Tests\Core\Routing

Code

public function acceptFilterProvider() {
    return [
        // Check that JSON routes get filtered and prioritized correctly.
[
            'application/json, text/xml;q=0.9',
            'json',
            'route_c',
            'route_e',
        ],
        // Tests a JSON request with alternative JSON MIME type Accept header.
[
            'application/x-json, text/xml;q=0.9',
            'json',
            'route_c',
            'route_e',
        ],
        // Tests a standard HTML request.
[
            'text/html, text/xml;q=0.9',
            'html',
            'route_e',
            'route_c',
        ],
    ];
}

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