Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / field / tests / src / Kernel / BulkDeleteTest.php
index 900c154b4b065bae865df958ad81be5d687c2bef..8c3ee5f26cff3f63081cf2c23bc36616d265fe78 100644 (file)
@@ -105,7 +105,7 @@ class BulkDeleteTest extends FieldKernelTestBase {
       'field_name' => 'bf_1',
       'entity_type' => $this->entityTypeId,
       'type' => 'test_field',
-      'cardinality' => 1
+      'cardinality' => 1,
     ]);
     $field_storage->save();
     $this->fieldStorages[] = $field_storage;
@@ -113,7 +113,7 @@ class BulkDeleteTest extends FieldKernelTestBase {
       'field_name' => 'bf_2',
       'entity_type' => $this->entityTypeId,
       'type' => 'test_field',
-      'cardinality' => 4
+      'cardinality' => 4,
     ]);
     $field_storage->save();
     $this->fieldStorages[] = $field_storage;
@@ -162,10 +162,11 @@ class BulkDeleteTest extends FieldKernelTestBase {
     $bundle = reset($this->bundles);
     $field_storage = reset($this->fieldStorages);
     $field_name = $field_storage->getName();
-    $factory = \Drupal::service('entity.query');
+    $storage = \Drupal::entityTypeManager()->getStorage('entity_test');
 
     // There are 10 entities of this bundle.
-    $found = $factory->get('entity_test')
+    $found = $storage
+      ->getQuery()
       ->condition('type', $bundle)
       ->execute();
     $this->assertEqual(count($found), 10, 'Correct number of entities found before deleting');
@@ -181,7 +182,6 @@ class BulkDeleteTest extends FieldKernelTestBase {
     $this->assertEqual($field->getTargetBundle(), $bundle, 'The deleted field is for the correct bundle');
 
     // Check that the actual stored content did not change during delete.
-    $storage = \Drupal::entityManager()->getStorage($this->entityTypeId);
     /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
     $table_mapping = $storage->getTableMapping();
     $table = $table_mapping->getDedicatedDataTableName($field_storage);
@@ -194,7 +194,8 @@ class BulkDeleteTest extends FieldKernelTestBase {
     }
 
     // There are 0 entities of this bundle with non-deleted data.
-    $found = $factory->get('entity_test')
+    $found = $storage
+      ->getQuery()
       ->condition('type', $bundle)
       ->condition("$field_name.deleted", 0)
       ->execute();
@@ -202,7 +203,8 @@ class BulkDeleteTest extends FieldKernelTestBase {
 
     // There are 10 entities of this bundle when deleted fields are allowed, and
     // their values are correct.
-    $found = $factory->get('entity_test')
+    $found = $storage
+      ->getQuery()
       ->condition('type', $bundle)
       ->condition("$field_name.deleted", 1)
       ->sort('id')
@@ -222,7 +224,7 @@ class BulkDeleteTest extends FieldKernelTestBase {
       'field_name' => $field_name,
       'entity_type' => $this->entityTypeId,
       'type' => 'test_field',
-      'cardinality' => 1
+      'cardinality' => 1,
     ]);
     $deleted_field_storage->save();
     // Create the field.
@@ -253,7 +255,7 @@ class BulkDeleteTest extends FieldKernelTestBase {
       'field_name' => $field_name,
       'entity_type' => $this->entityTypeId,
       'type' => 'test_field',
-      'cardinality' => 1
+      'cardinality' => 1,
     ]);
     $field_storage->save();
     FieldConfig::create([