public function LingotekDashboardTest::testDashboardCanAddArabicLanguage in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 4.0.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.0.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.1.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.2.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.3.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.5.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.6.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.7.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
- 3.8.x tests/src/Functional/LingotekDashboardTest.php \Drupal\Tests\lingotek\Functional\LingotekDashboardTest::testDashboardCanAddArabicLanguage()
Test that arabic (somehow a special language) can be added.
File
- tests/
src/ Functional/ LingotekDashboardTest.php, line 131
Class
- LingotekDashboardTest
- Tests the Lingotek dashboard.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDashboardCanAddArabicLanguage() {
$url = Url::fromRoute('lingotek.dashboard_endpoint')
->setAbsolute()
->toString();
$post = [
'code' => 'ar',
'language' => 'Arabic',
'native' => 'العربية',
'direction' => 'RTL',
];
$request = $this->client
->post($url, [
'body' => http_build_query($post),
'cookies' => $this->cookies,
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/x-www-form-urlencoded',
],
'http_errors' => FALSE,
]);
$response = json_decode($request
->getBody(), TRUE);
$this
->assertIdentical('ar', $response['xcode']);
$this
->assertIdentical('ar', $response['locale']);
$this
->assertIdentical(1, $response['active']);
$this
->assertIdentical(1, $response['enabled']);
$this
->assertIdentical(0, $response['source']['total']);
$this
->assertIdentical(0, $response['target']['total']);
$arabic_language = ConfigurableLanguage::load('ar');
/** @var \Drupal\language\ConfigurableLanguageInterface $italian_language */
$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.
}