public function LocaleContentTest::testMachineNameLTR in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/locale/src/Tests/LocaleContentTest.php \Drupal\locale\Tests\LocaleContentTest::testMachineNameLTR()
Verifies that machine name fields are always LTR.
File
- core/
modules/ locale/ src/ Tests/ LocaleContentTest.php, line 31 - Contains \Drupal\locale\Tests\LocaleContentTest.
Class
- LocaleContentTest
- Tests you can enable multilingual support on content types and configure a language for a node.
Namespace
Drupal\locale\TestsCode
public function testMachineNameLTR() {
// User to add and remove language.
$admin_user = $this
->drupalCreateUser(array(
'administer languages',
'administer content types',
'access administration pages',
'administer site configuration',
));
// Log in as admin.
$this
->drupalLogin($admin_user);
// Verify that the machine name field is LTR for a new content type.
$this
->drupalGet('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
->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
$edit = array(
'site_default_language' => 'ar',
);
$this
->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration'));
// Verify that the machine name field is still LTR for a new content type.
$this
->drupalGet('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.');
}