function LinkUITest::testStaticLinkCreate in Link 6.2
Testing that if you use <strong> in a static title for your link, that the title actually displays <strong>.
File
- tests/
link.crud_browser.test, line 260 - Testing CRUD API in the browser.
Class
- LinkUITest
- Testing that users can not input bad URLs or labels
Code
function testStaticLinkCreate() {
$account = $this
->drupalCreateUser(array(
'administer content types',
'access content',
'create page content',
));
$this
->drupalLogin($account);
// create field
$name = strtolower($this
->randomName());
$field_name = 'field_' . $name;
$edit = array(
'_add_new_field[label]' => $name,
'_add_new_field[field_name]' => $name,
'_add_new_field[type]' => 'link',
'_add_new_field[widget_type]' => 'link',
);
$this
->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
$this
->drupalPost(NULL, array(
'title' => 'value',
'title_value' => '<strong>' . $name . '</strong>',
), t('Save field settings'));
// Is field created?
$this
->assertRaw(t('Added field %label.', array(
'%label' => $name,
)), 'Field added');
// create page form
$this
->drupalGet('node/add/page');
$this
->assertField($field_name . '[0][url]', 'URL found');
$input = array(
'href' => 'http://example.com/' . $this
->randomName(),
);
$edit = array(
'title' => $name,
$field_name . '[0][url]' => $input['href'],
);
$this
->drupalPost(NULL, $edit, t('Save'));
$url = $this
->getUrl();
// change to anonymous user
$this
->drupalLogout();
$this
->drupalGet($url);
$this
->assertRaw(l('<strong>' . $name . '</strong>', $input['href'], array(
'html' => TRUE,
)));
}