public function LingotekDashboardTest::testDashboardCanAddRTLLanguage in Lingotek Translation 8
Test that a language can be added.
File
- src/
Tests/ LingotekDashboardTest.php, line 64 - Contains \Drupal\lingotek\Tests\LingotekDashboardTest.
Class
- LingotekDashboardTest
- Tests the Lingotek dashboard.
Namespace
Drupal\lingotek\TestsCode
public function testDashboardCanAddRTLLanguage() {
// Login as admin.
$this
->drupalLogin($this->rootUser);
$post = [
'code' => 'ar_AE',
'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.
}