You are here

public function LingotekDashboardTest::testDashboardCanAddArabicLanguage in Lingotek Translation 8

Test that arabic (somehow a special language) can be added.

File

src/Tests/LingotekDashboardTest.php, line 89
Contains \Drupal\lingotek\Tests\LingotekDashboardTest.

Class

LingotekDashboardTest
Tests the Lingotek dashboard.

Namespace

Drupal\lingotek\Tests

Code

public function testDashboardCanAddArabicLanguage() {

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);
  $post = [
    'code' => 'ar',
    'language' => 'Arabic',
    'native' => 'العربية',
    'direction' => 'RTL',
  ];
  $request = $this
    ->drupalPost('/admin/lingotek/dashboard_endpoint', 'application/json', $post);
  $response = json_decode($request, TRUE);
  $arabic_language = ConfigurableLanguage::load('ar');

  /** @var $italian_language ConfigurableLanguageInterface */
  $this
    ->assertNotNull($arabic_language, 'Arabic language has been added.');
  $this
    ->assertIdentical('Arabic', $arabic_language
    ->getName());
  $this
    ->assertIdentical(ConfigurableLanguage::DIRECTION_RTL, $arabic_language
    ->getDirection());

  // @ToDo: The native language is not saved.
}