Commit 0eeda29f authored by alexpott's avatar alexpott

Issue #1981292 by aspilicious, pcambra, andypost, swentel: Drop procedural...

Issue #1981292 by aspilicious, pcambra, andypost, swentel: Drop procedural usage of fields in field_sql_storage() & field_ui() tests.
parent a4bfb01a
...@@ -207,7 +207,7 @@ function testNoFieldsDisplayOverview() { ...@@ -207,7 +207,7 @@ function testNoFieldsDisplayOverview() {
$this->drupalCreateContentType(array('type' => 'no_fields', 'name' => 'No fields')); $this->drupalCreateContentType(array('type' => 'no_fields', 'name' => 'No fields'));
// Remove the 'body' field. // Remove the 'body' field.
field_delete_instance(field_info_instance('node', 'body', 'no_fields')); field_info_instance('node', 'body', 'no_fields')->delete();
$this->drupalGet('admin/structure/types/manage/no_fields/display'); $this->drupalGet('admin/structure/types/manage/no_fields/display');
$this->assertRaw(t('There are no fields yet added. You can add new fields on the <a href="@link">Manage fields</a> page.', array('@link' => url('admin/structure/types/manage/no_fields/fields')))); $this->assertRaw(t('There are no fields yet added. You can add new fields on the <a href="@link">Manage fields</a> page.', array('@link' => url('admin/structure/types/manage/no_fields/fields'))));
......
...@@ -45,7 +45,7 @@ function setUp() { ...@@ -45,7 +45,7 @@ function setUp() {
'field_name' => 'field_' . $vocabulary->id(), 'field_name' => 'field_' . $vocabulary->id(),
'type' => 'taxonomy_term_reference', 'type' => 'taxonomy_term_reference',
); );
field_create_field($field); entity_create('field_entity', $field)->save();
$instance = array( $instance = array(
'field_name' => 'field_' . $vocabulary->id(), 'field_name' => 'field_' . $vocabulary->id(),
...@@ -53,7 +53,7 @@ function setUp() { ...@@ -53,7 +53,7 @@ function setUp() {
'label' => 'Tags', 'label' => 'Tags',
'bundle' => 'article', 'bundle' => 'article',
); );
field_create_instance($instance); entity_create('field_instance', $instance)->save();
entity_get_form_display('node', 'article', 'default') entity_get_form_display('node', 'article', 'default')
->setComponent('field_' . $vocabulary->id()) ->setComponent('field_' . $vocabulary->id())
...@@ -280,17 +280,16 @@ function testFieldPrefix() { ...@@ -280,17 +280,16 @@ function testFieldPrefix() {
function testDefaultValue() { function testDefaultValue() {
// Create a test field and instance. // Create a test field and instance.
$field_name = 'test'; $field_name = 'test';
$field = array( entity_create('field_entity', array(
'field_name' => $field_name, 'field_name' => $field_name,
'type' => 'test_field' 'type' => 'test_field'
); ))->save();
field_create_field($field); $instance = entity_create('field_instance', array(
$instance = array(
'field_name' => $field_name, 'field_name' => $field_name,
'entity_type' => 'node', 'entity_type' => 'node',
'bundle' => $this->type, 'bundle' => $this->type,
); ));
$instance = field_create_instance($instance); $instance->save();
entity_get_form_display('node', $this->type, 'default') entity_get_form_display('node', $this->type, 'default')
->setComponent($field_name) ->setComponent($field_name)
...@@ -431,14 +430,14 @@ function testHiddenFields() { ...@@ -431,14 +430,14 @@ function testHiddenFields() {
// Create a field and an instance programmatically. // Create a field and an instance programmatically.
$field_name = 'hidden_test_field'; $field_name = 'hidden_test_field';
field_create_field(array('field_name' => $field_name, 'type' => $field_name)); entity_create('field_entity', array('field_name' => $field_name, 'type' => $field_name))->save();
$instance = array( $instance = array(
'field_name' => $field_name, 'field_name' => $field_name,
'bundle' => $this->type, 'bundle' => $this->type,
'entity_type' => 'node', 'entity_type' => 'node',
'label' => t('Hidden field'), 'label' => t('Hidden field'),
); );
field_create_instance($instance); entity_create('field_instance', $instance)->save();
entity_get_form_display('node', $this->type, 'default') entity_get_form_display('node', $this->type, 'default')
->setComponent($field_name) ->setComponent($field_name)
->save(); ->save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment