You are here

public function RequestTest::testGetCharsets in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/RequestTest.php \Symfony\Component\HttpFoundation\Tests\RequestTest::testGetCharsets()

File

vendor/symfony/http-foundation/Tests/RequestTest.php, line 1284

Class

RequestTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testGetCharsets() {
  $request = new Request();
  $this
    ->assertEquals(array(), $request
    ->getCharsets());
  $request->headers
    ->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
  $this
    ->assertEquals(array(), $request
    ->getCharsets());

  // testing caching
  $request = new Request();
  $request->headers
    ->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
  $this
    ->assertEquals(array(
    'ISO-8859-1',
    'US-ASCII',
    'UTF-8',
    'ISO-10646-UCS-2',
  ), $request
    ->getCharsets());
  $request = new Request();
  $request->headers
    ->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
  $this
    ->assertEquals(array(
    'ISO-8859-1',
    'utf-8',
    '*',
  ), $request
    ->getCharsets());
}