public function RequestTest::testGetAcceptableContentTypes

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php, line 919

Class

RequestTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testGetAcceptableContentTypes() {
  $request = new Request();
  $this
    ->assertEquals(array(), $request
    ->getAcceptableContentTypes());
  $request->headers
    ->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*');
  $this
    ->assertEquals(array(), $request
    ->getAcceptableContentTypes());

  // testing caching
  $request = new Request();
  $request->headers
    ->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*');
  $this
    ->assertEquals(array(
    'multipart/mixed',
    '*/*',
    'text/html',
    'application/xhtml+xml',
    'text/vnd.wap.wml',
    'application/vnd.wap.xhtml+xml',
    'application/vnd.wap.wmlscriptc',
  ), $request
    ->getAcceptableContentTypes());
}