// Case 1: Empty request.
$this->
assertEquals(NULL,
$languageNegotiationContentEntity->
getLangcode());
// Case 2: A request is available, but the languageManager is not set and
// the static::QUERY_PARAMETER is not provided as a named parameter.
$request = Request::
create('/de/foo', 'GET'
);
$request->query =
new ParameterBag();
$this->
assertEquals(NULL,
$languageNegotiationContentEntity->
getLangcode($request));
// Case 3: A request is available, the languageManager is set, but the
// static::QUERY_PARAMETER is not provided as a named parameter.
$languageNegotiationContentEntity->
setLanguageManager($this->languageManager
);
$this->
assertEquals(NULL,
$languageNegotiationContentEntity->
getLangcode($request));
// Case 4: A request is available, the languageManager is set and the
// static::QUERY_PARAMETER is provided as a named parameter.
$expectedLangcode = 'de';
$request->query->
set(LanguageNegotiationContentEntity::QUERY_PARAMETER,
$expectedLangcode);
$this->
assertEquals($expectedLangcode,
$languageNegotiationContentEntity->
getLangcode($request));
// Case 5: A request is available, the languageManager is set and the
// static::QUERY_PARAMETER is provided as a named parameter with a given
// langcode that is not one of the system supported ones.