X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffield%2Ftests%2Fsrc%2FKernel%2FBulkDeleteTest.php;fp=web%2Fcore%2Fmodules%2Ffield%2Ftests%2Fsrc%2FKernel%2FBulkDeleteTest.php;h=8c3ee5f26cff3f63081cf2c23bc36616d265fe78;hp=900c154b4b065bae865df958ad81be5d687c2bef;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/field/tests/src/Kernel/BulkDeleteTest.php b/web/core/modules/field/tests/src/Kernel/BulkDeleteTest.php index 900c154b4..8c3ee5f26 100644 --- a/web/core/modules/field/tests/src/Kernel/BulkDeleteTest.php +++ b/web/core/modules/field/tests/src/Kernel/BulkDeleteTest.php @@ -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([