diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php index b0e52b2..cd6fa31 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -61,13 +61,14 @@ function setUp() { $figures = drupal_strtolower($this->randomName()); $greetings = drupal_strtolower($this->randomName()); foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) { - $fields[] = $field = entity_create('field_instance', array( + $field = entity_create('field_entity', array( 'field_name' => $field_name, 'type' => $field_type, 'cardinality' => 2, 'translatable' => TRUE, )); $field->save(); + $fields[] = $field; } $bundles = array(); for ($i = 0; $i < 2; $i++) { @@ -78,12 +79,11 @@ function setUp() { } while ($bundles && strtolower($bundles[0]) >= strtolower($bundle)); entity_test_create_bundle($bundle); foreach ($fields as $field) { - $instance = entity_create('field_instance', array( - 'field_name' => $field['field_name'], + entity_create('field_instance', array( + 'field_name' => $field->id(), 'entity_type' => 'entity_test_mulrev', 'bundle' => $bundle, - )); - $instance->save(); + ))->save(); } $bundles[] = $bundle; } @@ -410,12 +410,11 @@ protected function testCount() { // can test whether cross entity type fields produce the correct query. $field_name = $this->figures; $bundle = $this->randomName(); - $instance = entity_create('field_instance', array( + entity_create('field_instance', array( 'field_name' => $field_name, 'entity_type' => 'entity_test', 'bundle' => $bundle, - )); - $instance->save(); + ))->save(); $entity = entity_create('entity_test', array( 'id' => 1, diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php index 170b8ed..683bbda 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php @@ -216,13 +216,13 @@ function testRegistrationWithUserFields() { // Check that the field does not appear on the registration form. $this->drupalGet('user/register'); - $this->assertNoText($instance->id(), 'The field does not appear on user registration form'); + $this->assertNoText($instance->label(), 'The field does not appear on user registration form'); // Have the field appear on the registration form. $instance->settings['user_register_form'] = TRUE; $instance->save(); $this->drupalGet('user/register'); - $this->assertText($instance->id(), 'The field appears on user registration form'); + $this->assertText($instance->label(), 'The field appears on user registration form'); // Check that validation errors are correctly reported. $edit = array(); @@ -231,11 +231,11 @@ function testRegistrationWithUserFields() { // Missing input in required field. $edit['test_user_field[und][0][value]'] = ''; $this->drupalPost(NULL, $edit, t('Create new account')); - $this->assertRaw(t('@name field is required.', array('@name' => $instance->id())), 'Field validation error was correctly reported.'); + $this->assertRaw(t('@name field is required.', array('@name' => $instance->label())), 'Field validation error was correctly reported.'); // Invalid input. $edit['test_user_field[und][0][value]'] = '-1'; $this->drupalPost(NULL, $edit, t('Create new account')); - $this->assertRaw(t('%name does not accept the value -1.', array('%name' => $instance->id())), 'Field validation error was correctly reported.'); + $this->assertRaw(t('%name does not accept the value -1.', array('%name' => $instance->label())), 'Field validation error was correctly reported.'); // Submit with valid data. $value = rand(1, 255); diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index 8bcf05b..0a10bf1 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -73,12 +73,11 @@ protected function setUp() { ), ) ))->save(); - $this->instance = array( + entity_create('field_instance', array( 'field_name' => $this->field_name, 'entity_type' => 'node', 'bundle' => 'page', - )); - $this->instance->save(); + ))->save(); // Create a time in the past for the archive. $time = REQUEST_TIME - 3600; diff --git a/core/scripts/generate-d7-content.sh b/core/scripts/generate-d7-content.sh index bb81e5a..87ec22a 100644 --- a/core/scripts/generate-d7-content.sh +++ b/core/scripts/generate-d7-content.sh @@ -93,7 +93,7 @@ ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $node_types = $i > 11 ? array('page') : array_keys(node_type_get_types()); foreach ($node_types as $bundle) { $instance = array( @@ -132,7 +132,7 @@ 'settings' => array(), ); } - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } $parents = array(); // Vocabularies without hierarchy get one term, single parent vocabularies get