1 locale.test | LocaleContentFunctionalTest::testMachineNameLTR() |
Verifies that machine name fields are always LTR.
File
- core/
modules/ locale/ tests/ locale.test, line 1846 - Tests for locale.module.
Class
- LocaleContentFunctionalTest
- Functional tests for multilingual support on nodes.
Code
function testMachineNameLTR() {
// User to add and remove language.
$admin_user = $this->backdropCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
// Log in as admin.
$this->backdropLogin($admin_user);
// Verify that the machine name field is LTR for a new content type.
$this->backdropGet('admin/structure/types/add');
$this->assertFieldByXpath('//input[@name="type" and @dir="ltr"]', NULL, 'The machine name field is LTR when no additional language is configured.');
// Install the Arabic language (which is RTL) and configure as the default.
$edit = array();
$edit['predefined_langcode'] = 'ar';
$this->backdropPost('admin/config/regional/language/add', $edit, t('Add language'));
$edit = array();
$edit['site_default'] = 'ar';
$this->backdropPost(NULL, $edit, t('Save configuration'));
// Verify that the machine name field is still LTR for a new content type.
$this->backdropGet('admin/structure/types/add');
$this->assertFieldByXpath('//input[@name="type" and @dir="ltr"]', NULL, 'The machine name field is LTR when the default language is RTL.');
}