// Check correct headers.
$this->
drupalGet('/en/system-test/echo/language test',
[],
['Accept-Language' => 'en'
]);
$this->
assertSession()->
responseHeaderEquals('Content-Language', 'en'
);
$this->
assertSession()->
responseHeaderEquals('X-Drupal-Cache', 'MISS'
);
$this->
drupalGet('/fr/system-test/echo/language test',
[],
['Accept-Language' => 'en'
]);
$this->
assertSession()->
responseHeaderEquals('Content-Language', 'fr'
);
$this->
assertSession()->
responseHeaderEquals('X-Drupal-Cache', 'MISS'
);
$this->
drupalGet('/system-test/echo/language test',
[],
['Accept-Language' => 'en'
]);
$this->
assertSession()->
responseHeaderEquals('Content-Language', 'en'
);
$this->
assertSession()->
responseHeaderDoesNotExist('X-Drupal-Cache'
);
// Check with UK browser.
$this->
drupalGet('/system-test/echo/language test',
[],
['Accept-Language' => 'en-UK,en'
]);
$this->
assertSession()->
responseHeaderEquals('Content-Language', 'en'
);
$this->
assertSession()->
responseHeaderDoesNotExist('X-Drupal-Cache'
);
// Check with french browser.
$this->
drupalGet('/system-test/echo/language test',
[],
['Accept-Language' => 'fr-FR,fr'
]);
$this->
assertSession()->
responseHeaderEquals('Content-Language', 'fr'
);
$this->
assertSession()->
responseHeaderDoesNotExist('X-Drupal-Cache'
);