1 link.ui.test | LinkUITest::testCRUDTitleOnlyTitleNoLink() |
Tests that if a field has a title but no URL, the title is not sanitized twice.
File
- core/
modules/ link/ tests/ link.ui.test, line 177 - Testing CRUD API in the browser.
Class
- LinkUITest
- Testing that users can not input bad URLs or labels
Code
function testCRUDTitleOnlyTitleNoLink() {
$name = strtolower($this->randomName());
$field_name = 'field_' . $name;
$edit = array(
'fields[_add_new_field][label]' => $name,
'fields[_add_new_field][field_name]' => $name,
'fields[_add_new_field][type]' => 'link_field',
'fields[_add_new_field][widget_type]' => 'link_field',
);
$this->backdropPost('admin/structure/types/manage/page/fields', $edit, t('Save'));
$this->backdropPost(NULL, array(
'instance[settings][url]' => 1,
), t('Save settings'));
$this->backdropGet('node/add/page');
$this->assertField($field_name . '[und][0][url]', 'URL found');
$input = array(
'title' => 'This & That',
'href' => '',
);
$edit = array(
'title' => $name,
$field_name . '[und][0][title]' => $input['title'],
$field_name . '[und][0][url]' => $input['href'],
);
$this->backdropPost(NULL, $edit, t('Save'));
$this->assertRaw('This & That');
}