/**
  * Test base field saving.
  *
  * @dataProvider fieldDataProvider
  */
 public function testFieldSaving($field_name, $type, $module)
 {
     $handler = new DefaultFieldHandler($field_name, $type);
     $field = $handler->save();
     $this->assertEquals($type, $field['type']);
     $this->assertEquals($field_name, $field['field_name']);
     $this->assertEquals($module, $field['module']);
     $this->assertEquals(FALSE, $field['locked']);
     $this->assertEquals(1, $field['active']);
     $this->assertEquals(0, $field['deleted']);
     $this->assertEquals(1, $field['cardinality']);
     $this->assertEquals(FALSE, $field['translatable']);
     field_delete_field($field_name);
 }
 /**
  * Test instance field creation.
  *
  * @dataProvider fieldDataProvider
  */
 public function testFieldInstanceCreation($field_name, $type, $label, $widget, $default_formatter, $teaser_formatter)
 {
     $base_handler = new DefaultBaseFieldHandler($field_name, $type);
     $base_handler->save();
     $handler = new DefaultInstanceFieldHandler($field_name, 'node', self::CONTENT_TYPE_WITHOUT_FIELDS);
     $handler->label($label)->widget($widget)->display('default', $default_formatter, 'inline')->display('teaser', $teaser_formatter);
     $instance = $handler->getField();
     $handler->save();
     $saved_instance = field_info_instance('node', $field_name, self::CONTENT_TYPE_WITHOUT_FIELDS);
     $this->assertEquals($label, $saved_instance['label']);
     $this->assertEquals($widget, $saved_instance['widget']['type']);
     $this->assertEquals($default_formatter, $saved_instance['display']['default']['type']);
     $this->assertEquals($teaser_formatter, $saved_instance['display']['teaser']['type']);
     field_delete_field($field_name);
 }