diff core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 1fec387a4317
line wrap: on
line diff
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceAdminTest.php	Fri Feb 23 15:52:07 2018 +0000
@@ -330,6 +330,12 @@
     $this->drupalPostForm(NULL, $edit, t('Save field settings'));
     $this->drupalGet($bundle_path . '/fields/' . $field_path);
     $term_name = $this->randomString();
+    $result = \Drupal::entityQuery('taxonomy_term')
+      ->condition('name', $term_name)
+      ->condition('vid', 'tags')
+      ->accessCheck(FALSE)
+      ->execute();
+    $this->assertIdentical(0, count($result), "No taxonomy terms exist with the name '$term_name'.");
     $edit = [
       // This must be set before new entities will be auto-created.
       'settings[handler_settings][auto_create]' => 1,
@@ -342,8 +348,12 @@
     ];
     $this->drupalPostForm(NULL, $edit, t('Save settings'));
     // The term should now exist.
-    $term = taxonomy_term_load_multiple_by_name($term_name, 'tags')[1];
-    $this->assertIdentical(1, count($term), 'Taxonomy term was auto created when set as field default.');
+    $result = \Drupal::entityQuery('taxonomy_term')
+      ->condition('name', $term_name)
+      ->condition('vid', 'tags')
+      ->accessCheck(FALSE)
+      ->execute();
+    $this->assertIdentical(1, count($result), 'Taxonomy term was auto created when set as field default.');
   }
 
   /**