public function LinkTokenTest::xTestUserTokenLinkCreateInUrl in Link 7
Trying to set the url to contain a token.
File
- tests/
LinkTokenTest.test, line 293 - Testing that tokens can be used in link titles.
Class
- LinkTokenTest
- Testing that tokens can be used in link titles.
Code
public function xTestUserTokenLinkCreateInUrl() {
$this->web_user = $this
->drupalCreateUser(array(
'administer content types',
'administer fields',
'access content',
'create page content',
));
$this
->drupalLogin($this->web_user);
// Create field.
$name = strtolower($this
->randomName());
$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' => 'required',
'enable_tokens' => 1,
), 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');
$field_name = 'field_' . $name;
$this
->assertField($field_name . '[0][title]', 'Title found');
$this
->assertField($field_name . '[0][url]', 'URL found');
$input = array(
'href' => 'http://example.com/' . $this
->randomName(),
'label' => $this
->randomName(),
);
$this
->drupalLogin($this->web_user);
$this
->drupalGet('node/add/page');
$edit = array(
'title' => $input['label'],
$field_name . '[0][title]' => $input['label'],
$field_name . '[0][url]' => $input['href'] . "/[type]",
);
$this
->drupalPost(NULL, $edit, t('Save'));
$url = $this
->getUrl();
// Change to anonymous user.
$this
->drupalLogout();
$this
->drupalGet($url);
$this
->assertRaw(l($input['label'], $input['href'] . '/page'));
// $this->fail($this->content);.
}