public function LanguageContextTest::testLanguageContext in GraphQL 8.3
Test the language context service.
File
- tests/
src/ Kernel/ Framework/ LanguageContextTest.php, line 123
Class
- LanguageContextTest
- Test contextual language negotiation.
Namespace
Drupal\Tests\graphql\Kernel\FrameworkCode
public function testLanguageContext() {
$context = $this->container
->get('graphql.language_context');
$this
->assertEquals('fr', $context
->executeInLanguageContext(function () {
return \Drupal::service('graphql.language_context')
->getCurrentLanguage();
}, 'fr'), 'Unexpected language context result.');
}