You are here

public function AllowedLanguagesUserFieldTest::testAllowedLanguageGetAllowedLanguagesForUser in Allowed Languages 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/AllowedLanguagesUserFieldTest.php \Drupal\Tests\allowed_languages\Kernel\AllowedLanguagesUserFieldTest::testAllowedLanguageGetAllowedLanguagesForUser()

Test the allowed languages function to get a users languages.

File

tests/src/Kernel/AllowedLanguagesUserFieldTest.php, line 22

Class

AllowedLanguagesUserFieldTest
Tests for the allowed languages field added fo the user entity.

Namespace

Drupal\Tests\allowed_languages\Kernel

Code

public function testAllowedLanguageGetAllowedLanguagesForUser() {
  $allowed_languages = \Drupal::service('allowed_languages.allowed_languages_manager')
    ->assignedLanguages($this->user);
  $this
    ->assertEquals($allowed_languages, [
    'sv',
    'en',
  ]);
}