protected function LinkFieldAttributesTest::createSimpleLinkField in Link 7
Create Simple Link Field.
7 calls to LinkFieldAttributesTest::createSimpleLinkField()
- LinkFieldAttributesTest::testFormatterHost in tests/
LinkFieldAttributesTest.test - Formatter Host.
- LinkFieldAttributesTest::testFormatterLabel in tests/
LinkFieldAttributesTest.test - Formatter Label.
- LinkFieldAttributesTest::testFormatterPlain in tests/
LinkFieldAttributesTest.test - Test the link_plain formatter and it's output.
- LinkFieldAttributesTest::testFormatterPlainTitle in tests/
LinkFieldAttributesTest.test - Formatter Plain Title.
- LinkFieldAttributesTest::testFormatterSeparate in tests/
LinkFieldAttributesTest.test - Formatter Separate.
File
- tests/
LinkFieldAttributesTest.test, line 165 - Field attributes test.
Class
- LinkFieldAttributesTest
- Field attributes test.
Code
protected function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) {
$this
->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/fields');
$edit = array(
'fields[_add_new_field][label]' => $single_field_name_friendly,
'fields[_add_new_field][field_name]' => $single_field_name_machine,
'fields[_add_new_field][type]' => 'link_field',
'fields[_add_new_field][widget_type]' => 'link_field',
);
$this
->drupalPost(NULL, $edit, t('Save'));
// We'll go with the default settings for this run-through.
$this
->drupalPost(NULL, array(), t('Save field settings'));
// Using all the default settings, so press the button.
$this
->drupalPost(NULL, array(), t('Save settings'));
$this
->assertText(t('Saved @name configuration.', array(
'@name' => $single_field_name_friendly,
)));
// Somehow clicking "save" isn't enough, and we have to do a
// node_types_rebuild().
node_types_rebuild();
menu_rebuild();
$type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(
':type' => $content_type_machine,
))
->fetchField();
$this
->assertTrue($type_exists, 'The new content type has been created in the database.');
}