public function RulesUiTestCase::testConditionLabel in Rules 7.2
Tests that NOT condition labels are not HTML-encoded in the UI.
See also
https://www.drupal.org/project/rules/issues/1945006
File
- rules_admin/
tests/ rules_admin.test, line 38 - Rules UI tests.
Class
- RulesUiTestCase
- Tests for creating rules through the UI.
Code
public function testConditionLabel() {
// Create a simple user account with permission to create a rule.
$user = $this
->drupalCreateUser(array(
'access administration pages',
'administer rules',
));
$this
->drupalLogin($user);
// First we need an event.
$this
->drupalGet('admin/config/workflow/rules/reaction/add');
$edit = array(
'settings[label]' => 'Test node event',
'settings[name]' => 'test_node_event',
'event' => 'node_insert',
);
$this
->drupalPost(NULL, $edit, 'Save');
$this
->assertText('Editing reaction rule', 'Rule edit page is shown.');
// Now add a condition with a special character in the label.
$this
->clickLink('Add condition');
$this
->assertText('Add a new condition', 'Condition edit page is shown.');
$edit = array(
'element_name' => 'rules_test_condition_apostrophe',
);
$this
->drupalPost(NULL, $edit, 'Continue');
// Negate the condition, as this is how it gets improperly HTML encoded.
$edit = array(
'negate' => TRUE,
);
$this
->drupalPost(NULL, $edit, 'Save');
$this
->assertNoRaw("'", 'Apostrophe is not HTML-encoded.');
}