protected function LinkBaseTestClass::createLinkField in Link 7
Create Link Field.
11 calls to LinkBaseTestClass::createLinkField()
- LinkConvertInternalPathsTest::testInternalPathConversion in tests/
LinkConvertInternalPathsTest.test - Test the alias handling.
- LinkDefaultProtocolTest::createNodeWithLink in tests/
LinkDefaultProtocolTest.test - Create a page node with a link field.
- LinkEntityTokenTest::testFieldTokenNodeLoaded in tests/
LinkEntityTokenTest.test - Creates a link field, fills it, then uses a loaded node to test tokens.
- LinkEntityTokenTest::testFieldTokenNodeViewed in tests/
LinkEntityTokenTest.test - Field Token Node Viewed.
- LinkFieldCrudTest::testLinkTitlePreservesQueryParams in tests/
LinkFieldCrudTest.test - Tests that link titles properly preserve the query params.
File
- tests/
LinkBaseTestClass.test, line 49 - Base test class with helper methods, etc.
Class
- LinkBaseTestClass
- Base test class with helper methods, etc.
Code
protected function createLinkField($node_type = 'page', $settings = array()) {
$name = strtolower($this
->randomName());
$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',
);
$field_name = 'field_' . $name;
$this
->drupalPost('admin/structure/types/manage/' . $node_type . '/fields', $edit, t('Save'));
$this
->drupalPost(NULL, array(), t('Save field settings'));
$this
->drupalPost(NULL, $settings, t('Save settings'));
// Is field created?
$this
->assertRaw(t('Saved %label configuration', array(
'%label' => $name,
)), 'Field added');
node_types_rebuild();
menu_rebuild();
return $field_name;
}