protected function ConfigTranslationUiTest::assertDisabledTextarea in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php \Drupal\config_translation\Tests\ConfigTranslationUiTest::assertDisabledTextarea()
Asserts that a textarea with a given ID has been disabled from editing.
Parameters
string $id: The HTML ID of the textarea.
Return value
bool TRUE if the assertion passed; FALSE otherwise.
1 call to ConfigTranslationUiTest::assertDisabledTextarea()
- ConfigTranslationUiTest::testTextFormatTranslation in core/
modules/ config_translation/ src/ Tests/ ConfigTranslationUiTest.php - Test text_format translation.
File
- core/
modules/ config_translation/ src/ Tests/ ConfigTranslationUiTest.php, line 1043 - Contains \Drupal\config_translation\Tests\ConfigTranslationUiTest.
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\config_translation\TestsCode
protected function assertDisabledTextarea($id) {
$textarea = $this
->xpath('//textarea[@id=:id and contains(@disabled, "disabled")]', array(
':id' => $id,
));
$textarea = reset($textarea);
$passed = $this
->assertTrue($textarea instanceof \SimpleXMLElement, SafeMarkup::format('Disabled field @id exists.', array(
'@id' => $id,
)));
$expected = 'This field has been disabled because you do not have sufficient permissions to edit it.';
$passed = $passed && $this
->assertEqual((string) $textarea, $expected, SafeMarkup::format('Disabled textarea @id hides text in an inaccessible text format.', array(
'@id' => $id,
)));
// Make sure the text format select is not shown.
$select_id = str_replace('value', 'format--2', $id);
$select = $this
->xpath('//select[@id=:id]', array(
':id' => $select_id,
));
return $passed && $this
->assertFalse($select, SafeMarkup::format('Field @id does not exist.', array(
'@id' => $id,
)));
}