Sets up Drupal unit test environment.
Overrides DrupalUnitTestBase::setUp
DrupalUnitTestBase::$modules
function setUp() {
parent::setUp();
// Configure the theme system.
$this
->installConfig(array(
'system',
'field',
));
$this
->installSchema('entity_test', 'entity_test');
// @todo Add helper methods for all of the following.
$this->entity_type = 'entity_test';
if (!isset($this->bundle)) {
$this->bundle = $this->entity_type;
}
$this->field_name = drupal_strtolower($this
->randomName());
$this->field_type = 'text_long';
$this->field_settings = array();
$this->instance_settings = array(
'text_processing' => FALSE,
);
$this->formatter_type = 'text_plain';
$this->formatter_settings = array();
$this->field = array(
'field_name' => $this->field_name,
'type' => $this->field_type,
'settings' => $this->field_settings,
);
$this->field = field_create_field($this->field);
$this->instance = array(
'entity_type' => $this->entity_type,
'bundle' => $this->bundle,
'field_name' => $this->field_name,
'label' => $this
->randomName(),
'settings' => $this->instance_settings,
);
$this->instance = field_create_instance($this->instance);
$this->view_mode = 'default';
$this->display = entity_get_display($this->entity_type, $this->bundle, $this->view_mode)
->setComponent($this->field_name, array(
'type' => $this->formatter_type,
'settings' => $this->formatter_settings,
));
$this->display
->save();
$this->langcode = Language::LANGCODE_NOT_SPECIFIED;
}