Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.238 diff -u -p -r1.238 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 28 Sep 2010 03:30:37 -0000 1.238 +++ modules/simpletest/drupal_web_test_case.php 30 Sep 2010 02:22:46 -0000 @@ -912,6 +912,32 @@ class DrupalWebTestCase extends DrupalTe } /** + * Creates a default configuration from the testing installation profile. + * + * @param $module + * The name of a module, for which a corresponding _testing_install_MODULE + * function exists in the testing installation profile. For example, pass + * "node" to invoke the corresponding function _testing_install_node(). + * The corresponding function must exist in testing.install. + * Note that some default configurations depend on other, and potential + * dependencies have to be created manually; e.g., pass "node" before "rdf". + * + * @see standard.install + */ + protected function drupalCreateTestConfiguration($module) { + require_once DRUPAL_ROOT . '/' . drupal_get_path('profile', 'testing') . '/testing.install'; + $function = '_testing_install_' . $module; + $function(); + + // Update the menu router information. + menu_rebuild(); + // Reset permissions to catch any new. + $this->checkPermissions(array(), TRUE); + + $this->pass(t('Created test configuration for %module.', array('%module' => $module))); + } + + /** * Get a list files that can be used in tests. * * @param $type @@ -982,16 +1008,18 @@ class DrupalWebTestCase extends DrupalTe } /** - * Create a user with a given set of permissions. The permissions correspond to the - * names given on the privileges page. + * Create a user with a given set of permissions. * * @param $permissions - * Array of permission names to assign to user. + * Array of permission names to assign to the user. Note that the user + * always has the default permissions derived from the + * "authenticated users" role. + * * @return * A fully loaded user object with pass_raw property, or FALSE if account * creation fails. */ - protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) { + protected function drupalCreateUser(array $permissions = array()) { // Create a role with the given permission set. if (!($rid = $this->drupalCreateRole($permissions))) { return FALSE; Index: modules/simpletest/tests/actions.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/actions.test,v retrieving revision 1.18 diff -u -p -r1.18 actions.test --- modules/simpletest/tests/actions.test 5 Aug 2010 23:53:38 -0000 1.18 +++ modules/simpletest/tests/actions.test 30 Sep 2010 02:19:10 -0000 @@ -67,11 +67,13 @@ class ActionsConfigurationTestCase exten /** * Test actions executing in a potential loop, and make sure they abort properly. */ -class ActionLoopTestCase extends DrupalWebTestCase { +class ActionsLoopTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( - 'name' => 'Actions executing in a potentially infinite loop', - 'description' => 'Tests actions executing in a loop, and makes sure they abort properly.', + 'name' => 'Actions infinite loop', + 'description' => 'Tests actions executing in an infinite loop, and makes sure they abort properly.', 'group' => 'Actions', ); } Index: modules/simpletest/tests/ajax_forms_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/ajax_forms_test.module,v retrieving revision 1.7 diff -u -p -r1.7 ajax_forms_test.module --- modules/simpletest/tests/ajax_forms_test.module 6 May 2010 05:59:31 -0000 1.7 +++ modules/simpletest/tests/ajax_forms_test.module 30 Sep 2010 02:19:10 -0000 @@ -38,7 +38,6 @@ function ajax_forms_test_menu() { * A basic form used to test form_state['values'] during callback. */ function ajax_forms_test_simple_form($form, &$form_state) { - $form = array(); $form['select'] = array( '#type' => 'select', '#options' => array( Index: modules/simpletest/tests/form.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form.test,v retrieving revision 1.70 diff -u -p -r1.70 form.test --- modules/simpletest/tests/form.test 28 Sep 2010 02:30:32 -0000 1.70 +++ modules/simpletest/tests/form.test 30 Sep 2010 02:23:12 -0000 @@ -7,17 +7,19 @@ */ class FormsTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Form element validation', + 'name' => 'Element validation', 'description' => 'Tests various form element validation mechanisms.', 'group' => 'Form API', ); } function setUp() { - parent::setUp('form_test'); + parent::setUp('form_test', 'file'); + $this->drupalCreateTestConfiguration('filter'); } /** @@ -370,16 +372,18 @@ class FormsTestCase extends DrupalWebTes * Test form alter hooks. */ class FormAlterTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( - 'name' => 'Form alter hooks', + 'name' => 'Alter hooks', 'description' => 'Tests hook_form_alter() and hook_form_FORM_ID_alter().', 'group' => 'Form API', ); } function setUp() { - parent::setUp('form_test'); + parent::setUp('form_test', 'block'); } /** @@ -404,6 +408,8 @@ class FormAlterTestCase extends DrupalWe * Test form validation handlers. */ class FormValidationTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( 'name' => 'Form validation handlers', @@ -484,10 +490,11 @@ class FormValidationTestCase extends Dru * Test form element labels, required markers and associated output. */ class FormsElementsLabelsTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Form element and label output test', + 'name' => 'Labels and markers', 'description' => 'Test form element labels, required markers and associated output.', 'group' => 'Form API', ); @@ -557,10 +564,11 @@ class FormsElementsLabelsTestCase extend * Test the tableselect form element for expected behavior. */ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Tableselect form element type test', + 'name' => 'Tableselect', 'description' => 'Test the tableselect element for expected behavior', 'group' => 'Form API', ); @@ -570,14 +578,11 @@ class FormsElementsTableSelectFunctional parent::setUp('form_test'); } - /** * Test the display of checkboxes when #multiple is TRUE. */ function testMultipleTrue() { - $this->drupalGet('form_test/tableselect/multiple-true'); - $this->assertNoText(t('Empty text.'), t('Empty text should not be displayed.')); // Test for the presence of the Select all rows tableheader. @@ -594,7 +599,6 @@ class FormsElementsTableSelectFunctional */ function testMultipleFalse() { $this->drupalGet('form_test/tableselect/multiple-false'); - $this->assertNoText(t('Empty text.'), t('Empty text should not be displayed.')); // Test for the absence of the Select all rows tableheader. @@ -618,9 +622,7 @@ class FormsElementsTableSelectFunctional * Test the submission of single and multiple values when #multiple is TRUE. */ function testMultipleTrueSubmit() { - // Test a submission with one checkbox checked. - $edit = array(); $edit['tableselect[row1]'] = TRUE; $this->drupalPost('form_test/tableselect/multiple-true', $edit, 'Submit'); @@ -636,7 +638,6 @@ class FormsElementsTableSelectFunctional $this->assertText(t('Submitted: row1 = row1'), t('Checked checkbox row1.')); $this->assertText(t('Submitted: row2 = 0'), t('Unchecked checkbox row2.')); $this->assertText(t('Submitted: row3 = row3'), t('Checked checkbox row3.')); - } /** @@ -668,14 +669,11 @@ class FormsElementsTableSelectFunctional $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #multiple is FALSE, even when #js_select is TRUE.')); } - /** * Test the whether the option checker gives an error on invalid tableselect values for checkboxes. */ function testMultipleTrueOptionchecker() { - list($header, $options) = _form_test_tableselect_get_data(); - $form['tableselect'] = array( '#type' => 'tableselect', '#header' => $header, @@ -692,14 +690,11 @@ class FormsElementsTableSelectFunctional } - /** * Test the whether the option checker gives an error on invalid tableselect values for radios. */ function testMultipleFalseOptionchecker() { - list($header, $options) = _form_test_tableselect_get_data(); - $form['tableselect'] = array( '#type' => 'tableselect', '#header' => $header, @@ -716,7 +711,6 @@ class FormsElementsTableSelectFunctional $this->assertTrue(isset($errors['tableselect']), t('Option checker disallows invalid values for radio buttons.')); } - /** * Helper function for the option check test to submit a form while collecting errors. * @@ -738,9 +732,7 @@ class FormsElementsTableSelectFunctional $form_state['input']['form_id'] = $form_id; drupal_prepare_form($form_id, $form, $form_state); - drupal_process_form($form_id, $form, $form_state); - $errors = form_get_errors(); // Clear errors and messages. @@ -751,7 +743,6 @@ class FormsElementsTableSelectFunctional // to allow the caller lowlevel access to the form. return array($form, $form_state, $errors); } - } /** @@ -764,11 +755,12 @@ class FormsElementsTableSelectFunctional * values aren't lost due to a wrong form rebuild. */ class FormsFormStorageTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Multistep form using form storage', - 'description' => 'Tests a multistep form using form storage and makes sure validation and caching works right.', + 'name' => 'Multistep form storage', + 'description' => 'Tests a multistep form using form storage and makes sure validation and caching works right.', 'group' => 'Form API', ); } @@ -908,9 +900,11 @@ class FormsFormStorageTestCase extends D * Test wrapper form callbacks. */ class FormsFormWrapperTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( - 'name' => 'Form wrapper callback', + 'name' => 'Wrapper callback', 'description' => 'Tests form wrapper callbacks to pass a prebuilt form to form builder functions.', 'group' => 'Form API', ); @@ -934,6 +928,8 @@ class FormsFormWrapperTestCase extends D * Test $form_state clearance. */ class FormStateValuesCleanTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; + public static function getInfo() { return array( 'name' => 'Form state values clearance', @@ -986,7 +982,7 @@ class FormStateValuesCleanTestCase exten class FormsRebuildTestCase extends DrupalWebTestCase { public static function getInfo() { return array( - 'name' => 'Form rebuilding', + 'name' => 'Rebuild', 'description' => 'Tests functionality of drupal_rebuild_form().', 'group' => 'Form API', ); @@ -1076,10 +1072,11 @@ class FormsRebuildTestCase extends Drupa * Test the programmatic form submission behavior. */ class FormsProgrammaticTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Programmatic form submissions', + 'name' => 'Programmed submissions', 'description' => 'Test the programmatic form submission behavior.', 'group' => 'Form API', ); @@ -1156,10 +1153,11 @@ class FormsProgrammaticTestCase extends * Test that FAPI correctly determines $form_state['triggering_element']. */ class FormsTriggeringElementTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Form triggering element determination', + 'name' => 'Triggering element', 'description' => 'Test the determination of $form_state[\'triggering_element\'].', 'group' => 'Form API', ); @@ -1320,10 +1318,11 @@ class FormsArbitraryRebuildTestCase exte * Tests form API file inclusion. */ class FormsFileInclusionTestCase extends DrupalWebTestCase { + protected $profile = 'testing'; public static function getInfo() { return array( - 'name' => 'Form API file inclusion', + 'name' => 'Include files', 'description' => 'Tests form API file inclusion.', 'group' => 'Form API', ); @@ -1334,17 +1333,14 @@ class FormsFileInclusionTestCase extends } /** - * Tests loading an include specified in hook_menu(). + * Tests form state file inclusion. */ function testLoadMenuInclude() { + // Verify loading an include specified in hook_menu(). $this->drupalPostAJAX('form-test/load-include-menu', array(), array('op' => t('Save')), 'system/ajax', array(), array(), 'form-test-load-include-menu'); $this->assertText('Submit callback called.'); - } - /** - * Tests loading a custom specified inlcude. - */ - function testLoadCustomInclude() { + // Verify loading a custom specified include. $this->drupalPost('form-test/load-include-custom', array(), t('Save')); $this->assertText('Submit callback called.'); } Index: profiles/testing/testing.install =================================================================== RCS file: /cvs/drupal/drupal/profiles/testing/testing.install,v retrieving revision 1.2 diff -u -p -r1.2 testing.install --- profiles/testing/testing.install 27 Aug 2010 12:36:53 -0000 1.2 +++ profiles/testing/testing.install 30 Sep 2010 02:20:46 -0000 @@ -14,3 +14,455 @@ function testing_install() { user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content')); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content')); } + +/** + * Configures default text formats. + */ +function _testing_install_filter() { + $filtered_html_format = array( + 'name' => 'Filtered HTML', + 'weight' => 0, + 'filters' => array( + // URL filter. + 'filter_url' => array( + 'weight' => 0, + 'status' => 1, + ), + // HTML filter. + 'filter_html' => array( + 'weight' => 1, + 'status' => 1, + ), + // Line break filter. + 'filter_autop' => array( + 'weight' => 2, + 'status' => 1, + ), + // HTML corrector filter. + 'filter_htmlcorrector' => array( + 'weight' => 10, + 'status' => 1, + ), + ), + ); + $filtered_html_format = (object) $filtered_html_format; + filter_format_save($filtered_html_format); + + $full_html_format = array( + 'name' => 'Full HTML', + 'weight' => 1, + 'filters' => array( + // URL filter. + 'filter_url' => array( + 'weight' => 0, + 'status' => 1, + ), + // Line break filter. + 'filter_autop' => array( + 'weight' => 1, + 'status' => 1, + ), + // HTML corrector filter. + 'filter_htmlcorrector' => array( + 'weight' => 10, + 'status' => 1, + ), + ), + ); + $full_html_format = (object) $full_html_format; + filter_format_save($full_html_format); + + // Grant default permissions. + $filtered_html_permission = filter_permission_name($filtered_html_format); + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array($filtered_html_permission)); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array($filtered_html_permission)); +} + +/** + * Configures default blocks. + */ +function _testing_install_block() { + $default_theme = variable_get('theme_default', 'bartik'); + $admin_theme = 'seven'; + $values = array( + array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'search', + 'delta' => 'form', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => -1, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'node', + 'delta' => 'recent', + 'theme' => $admin_theme, + 'status' => 1, + 'weight' => 10, + 'region' => 'dashboard_main', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'login', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'navigation', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'management', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 1, + 'region' => 'sidebar_first', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'powered-by', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 10, + 'region' => 'footer', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'help', + 'theme' => $default_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'help', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => $admin_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'system', + 'delta' => 'help', + 'theme' => $admin_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'help', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'login', + 'theme' => $admin_theme, + 'status' => 1, + 'weight' => 10, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'user', + 'delta' => 'new', + 'theme' => $admin_theme, + 'status' => 1, + 'weight' => 0, + 'region' => 'dashboard_sidebar', + 'pages' => '', + 'cache' => -1, + ), + array( + 'module' => 'search', + 'delta' => 'form', + 'theme' => $admin_theme, + 'status' => 1, + 'weight' => -10, + 'region' => 'dashboard_sidebar', + 'pages' => '', + 'cache' => -1, + ), + ); + $query = db_insert('block') + ->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache')); + foreach ($values as $record) { + $query->values($record); + } + $query->execute(); +} + +/** + * Confgures default node types. + */ +function _testing_install_node() { + // For a complete list of available node type attributes, refer to the node + // type API documentation. + // @see http://api.drupal.org/api/HEAD/function/hook_node_info + $types = array( + array( + 'type' => 'page', + 'name' => st('Basic page'), + 'base' => 'node_content', + 'description' => st("Use basic pages for your static content, such as an 'About us' page."), + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + ), + array( + 'type' => 'article', + 'name' => st('Article'), + 'base' => 'node_content', + 'description' => st('Use articles for time-sensitive content like news, press releases or blog posts.'), + 'custom' => 1, + 'modified' => 1, + 'locked' => 0, + ), + ); + foreach ($types as $type) { + $type = node_type_set_defaults($type); + node_type_save($type); + node_add_body_field($type); + } + + // Default "Basic page" to not be promoted and do not display date and author + // information for it. + variable_set('node_options_page', array('status')); + variable_set('node_submitted_page', FALSE); + + // Grant default permissions. + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content')); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content')); +} + +/** + * Configures default RDF mappings. + */ +function _testing_install_rdf() { + $rdf_mappings = array( + array( + 'type' => 'node', + 'bundle' => 'page', + 'mapping' => array( + 'rdftype' => array('foaf:Document'), + ), + ), + array( + 'type' => 'node', + 'bundle' => 'article', + 'mapping' => array( + 'rdftype' => array('sioc:Item', 'foaf:Document'), + 'field_image' => array( + 'predicates' => array('og:image', 'rdfs:seeAlso'), + 'type' => 'rel', + ), + 'field_tags' => array( + 'predicates' => array('dc:subject'), + 'type' => 'rel', + ), + ), + ), + ); + foreach ($rdf_mappings as $rdf_mapping) { + rdf_mapping_save($rdf_mapping); + } +} + +/** + * Configures default comment settings. + */ +function _testing_install_comment() { + // Default "Basic page" to have comments disabled. + variable_set('comment_page', COMMENT_NODE_HIDDEN); + + // Grant default permissions. + user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments')); + user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access comments', 'post comments', 'post comments without approval')); +} + +/** + * Configures default user settings. + */ +function _testing_install_user() { + // Enable user picture support and set the default to a square thumbnail option. + variable_set('user_pictures', '1'); + variable_set('user_picture_dimensions', '1024x1024'); + variable_set('user_picture_file_size', '800'); + variable_set('user_picture_style', 'thumbnail'); + + // Allow visitor account creation with administrative approval. + variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL); + + // Create a default role for site administrators, with all available + // permissions assigned. + $admin_role = new stdClass(); + $admin_role->name = 'administrator'; + $admin_role->weight = 2; + user_role_save($admin_role); + user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission'))); + + // Set this as the administrator role. + variable_set('user_admin_role', $admin_role->rid); + + // Assign user 1 the "administrator" role. + db_insert('users_roles') + ->fields(array('uid' => 1, 'rid' => $admin_role->rid)) + ->execute(); +} + +/** + * Configures default taxonomy vocabularies and fields. + */ +function _testing_install_taxonomy() { + $description = st('Use tags to group articles on similar topics into categories.'); + $help = st('Enter a comma-separated list of words to describe your content.'); + $vocabulary = (object) array( + 'name' => 'Tags', + 'description' => $description, + 'machine_name' => 'tags', + 'help' => $help, + + ); + taxonomy_vocabulary_save($vocabulary); + + $field = array( + 'field_name' => 'field_' . $vocabulary->machine_name, + 'type' => 'taxonomy_term_reference', + // Set cardinality to unlimited for tagging. + 'cardinality' => FIELD_CARDINALITY_UNLIMITED, + 'settings' => array( + 'allowed_values' => array( + array( + 'vid' => $vocabulary->vid, + 'parent' => 0, + ), + ), + ), + ); + field_create_field($field); + + $instance = array( + 'field_name' => 'field_' . $vocabulary->machine_name, + 'entity_type' => 'node', + 'label' => $vocabulary->name, + 'bundle' => 'article', + 'description' => $vocabulary->help, + 'widget' => array( + 'type' => 'taxonomy_autocomplete', + 'weight' => -4, + ), + 'display' => array( + 'default' => array( + 'type' => 'taxonomy_term_reference_link', + 'weight' => 10, + ), + 'teaser' => array( + 'type' => 'taxonomy_term_reference_link', + 'weight' => 10, + ), + ), + ); + field_create_instance($instance); +} + +/** + * Configures default image fields. + */ +function _testing_install_image() { + // Many of the following values will be defaulted, they're included here as + // illustrative examples. + // @see http://api.drupal.org/api/function/field_create_field/7 + $field = array( + 'field_name' => 'field_image', + 'type' => 'image', + 'cardinality' => 1, + 'translatable' => TRUE, + 'locked' => FALSE, + 'indexes' => array('fid' => array('fid')), + 'settings' => array( + 'uri_scheme' => 'public', + 'default_image' => FALSE, + ), + 'storage' => array( + 'type' => 'field_sql_storage', + 'settings' => array(), + ), + ); + field_create_field($field); + + // Many of the following values will be defaulted, they're included here as + // illustrative examples. + // @see http://api.drupal.org/api/function/field_create_instance/7 + $instance = array( + 'field_name' => 'field_image', + 'entity_type' => 'node', + 'label' => 'Image', + 'bundle' => 'article', + 'description' => st('Upload an image to go with this article.'), + 'required' => FALSE, + 'settings' => array( + 'file_directory' => 'field/image', + 'file_extensions' => 'png gif jpg jpeg', + 'max_filesize' => '', + 'max_resolution' => '', + 'min_resolution' => '', + 'alt_field' => TRUE, + 'title_field' => '', + ), + 'widget' => array( + 'type' => 'image_image', + 'settings' => array( + 'progress_indicator' => 'throbber', + 'preview_image_style' => 'thumbnail', + ), + 'weight' => -1, + ), + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'type' => 'image', + 'settings' => array('image_style' => 'large', 'image_link' => ''), + 'weight' => -1, + ), + 'teaser' => array( + 'label' => 'hidden', + 'type' => 'image', + 'settings' => array('image_style' => 'medium', 'image_link' => 'content'), + 'weight' => -1, + ), + ), + ); + field_create_instance($instance); +}