Mercurial > hg > drupalISMI
view openmindattribute/tests/link.test @ 11:61dd2a96c4e2
add redirect /entity/%openmind_id as menu hook.
author | casties |
---|---|
date | Mon, 06 Jul 2015 18:53:41 +0200 |
parents | 124ef8f3b22d |
children |
line wrap: on
line source
<?php /** * @file * Link base test file - contains common functions for testing links. */ class LinkBaseTestClass extends DrupalWebTestCase { protected $permissions = array( 'access content', 'administer content types', 'administer nodes', 'administer filters', 'access comments', 'post comments', 'access administration pages', 'create page content', ); function setUp() { $modules = func_get_args(); $modules = (isset($modules[0]) && is_array($modules[0]) ? $modules[0] : $modules); $modules[] = 'field_ui'; $modules[] = 'link'; parent::setUp($modules); $this->web_user = $this->drupalCreateUser($this->permissions); $this->drupalLogin($this->web_user); } 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; } }