You are here

public function RequestTest::testGetEncodings 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::testGetEncodings()

File

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

Class

RequestTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testGetEncodings() {
  $request = new Request();
  $this
    ->assertEquals(array(), $request
    ->getEncodings());
  $request->headers
    ->set('Accept-Encoding', 'gzip,deflate,sdch');
  $this
    ->assertEquals(array(), $request
    ->getEncodings());

  // testing caching
  $request = new Request();
  $request->headers
    ->set('Accept-Encoding', 'gzip,deflate,sdch');
  $this
    ->assertEquals(array(
    'gzip',
    'deflate',
    'sdch',
  ), $request
    ->getEncodings());
  $request = new Request();
  $request->headers
    ->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7');
  $this
    ->assertEquals(array(
    'deflate',
    'compress',
    'gzip',
  ), $request
    ->getEncodings());
}