public function SoftLengthLimitWebTestCase::setUp in Soft Length Limit 7
Setup for individual tests.
Overrides DrupalWebTestCase::setUp
File
- ./
soft_length_limit.test, line 27 - Test case for soft_length_limit module
Class
- SoftLengthLimitWebTestCase
- Tests the relevant functionality provided by the soft_length_limit module.
Code
public function setUp() {
// Enable any modules required for the test.
parent::setUp(array(
'soft_length_limit',
));
// Creating the needed user.
$this->privileged_user = $this
->drupalCreateUser(array(
'bypass node access',
'administer nodes',
'administer taxonomy',
'edit terms in 1',
));
$this
->drupalLogin($this->privileged_user);
// Creating the needed field on the article node type.
$field = array(
'field_name' => 'field_test',
'type' => 'text_long',
'cardinality' => 1,
'settings' => array(),
);
field_create_field($field);
$instance = array(
'field_name' => 'field_test',
'entity_type' => 'node',
'label' => 'Test field',
'required' => 0,
'bundle' => 'article',
'description' => '',
'widget' => array(
'type' => 'text_textarea',
'weight' => -4,
'settings' => array(
'rows' => '5',
'soft_length_limit' => '666',
),
),
'display' => array(
'default' => array(
'type' => 'text_default',
'weight' => 10,
),
'teaser' => array(
'type' => 'text_default',
'weight' => 10,
),
),
);
field_create_instance($instance);
$this
->drupalGet('node/add/article');
}