protected function FilterFormTest::assertDisabledTextarea in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/filter/src/Tests/FilterFormTest.php \Drupal\filter\Tests\FilterFormTest::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 FilterFormTest::assertDisabledTextarea()
- FilterFormTest::doFilterFormTestAsNonAdmin in core/
modules/ filter/ src/ Tests/ FilterFormTest.php - Tests the behavior of the 'text_format' element as a normal user.
File
- core/
modules/ filter/ src/ Tests/ FilterFormTest.php, line 298 - Contains \Drupal\filter\Tests\FilterFormTest.
Class
- FilterFormTest
- Tests form elements with associated text formats.
Namespace
Drupal\filter\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);
return $passed && $this
->assertNoSelect($select_id);
}