diff --git a/core/modules/field/src/Tests/BulkDeleteTest.php b/core/modules/field/src/Tests/BulkDeleteTest.php index 8aae012..de49be1 100644 --- a/core/modules/field/src/Tests/BulkDeleteTest.php +++ b/core/modules/field/src/Tests/BulkDeleteTest.php @@ -48,9 +48,9 @@ class BulkDeleteTest extends FieldUnitTestBase { /** * The entity type to be used in the test classes. * - * @var array + * @var string */ - protected $entityType = 'entity_test'; + protected $entityTypeId = 'entity_test'; /** * Tests that the expected hooks have been invoked on the expected entities. @@ -107,7 +107,7 @@ protected function setUp() { // Create two field storages. $field_storage = entity_create('field_storage_config', array( 'field_name' => 'bf_1', - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'type' => 'test_field', 'cardinality' => 1 )); @@ -115,7 +115,7 @@ protected function setUp() { $this->fieldStorages[] = $field_storage; $field_storage = entity_create('field_storage_config', array( 'field_name' => 'bf_2', - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'type' => 'test_field', 'cardinality' => 4 )); @@ -132,14 +132,14 @@ protected function setUp() { ))->save(); } for ($i = 0; $i < 10; $i++) { - $entity = entity_create($this->entityType, array('type' => $bundle)); + $entity = entity_create($this->entityTypeId, array('type' => $bundle)); foreach ($this->fieldStorages as $field_storage) { $entity->{$field_storage->getName()}->setValue($this->_generateTestFieldValues($field_storage->getCardinality())); } $entity->save(); } } - $this->entities = entity_load_multiple($this->entityType); + $this->entities = entity_load_multiple($this->entityTypeId); foreach ($this->entities as $entity) { // This test relies on the entities having stale field definitions // so that the deleted field can be accessed on them. Access the field @@ -172,7 +172,7 @@ function testDeleteField() { $this->assertEqual(count($found), 10, 'Correct number of entities found before deleting'); // Delete the field. - $field = FieldConfig::loadByName($this->entityType, $bundle, $field_name); + $field = FieldConfig::loadByName($this->entityTypeId, $bundle, $field_name); $field->delete(); // The field still exists, deleted. @@ -182,7 +182,7 @@ function testDeleteField() { $this->assertEqual($field->bundle, $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->entityType); + $storage = \Drupal::entityManager()->getStorage($this->entityTypeId); /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */ $table_mapping = $storage->getTableMapping(); $table = $table_mapping->getDedicatedDataTableName($field_storage); @@ -225,7 +225,7 @@ function testPurgeField() { $field_name = $field_storage->getName(); // Delete the field. - $field = FieldConfig::loadByName($this->entityType, $bundle, $field_name); + $field = FieldConfig::loadByName($this->entityTypeId, $bundle, $field_name); $field->delete(); // No field hooks were called. @@ -286,7 +286,7 @@ function testPurgeFieldStorage() { // Delete the first field. $bundle = reset($this->bundles); - $field = FieldConfig::loadByName($this->entityType, $bundle, $field_name); + $field = FieldConfig::loadByName($this->entityTypeId, $bundle, $field_name); $field->delete(); // Assert that FieldItemInterface::delete() was not called yet. @@ -323,7 +323,7 @@ function testPurgeFieldStorage() { // Delete the second field. $bundle = next($this->bundles); - $field = FieldConfig::loadByName($this->entityType, $bundle, $field_name); + $field = FieldConfig::loadByName($this->entityTypeId, $bundle, $field_name); $field->delete(); // Assert that FieldItemInterface::delete() was not called yet. diff --git a/core/modules/field/src/Tests/TranslationWebTest.php b/core/modules/field/src/Tests/TranslationWebTest.php index ec0e6c5..6fd241a 100644 --- a/core/modules/field/src/Tests/TranslationWebTest.php +++ b/core/modules/field/src/Tests/TranslationWebTest.php @@ -38,7 +38,7 @@ class TranslationWebTest extends FieldTestBase { * * @var string */ - protected $entityType = 'entity_test_mulrev'; + protected $entityTypeId = 'entity_test_mulrev'; /** * The field storage to use in this test. @@ -61,21 +61,21 @@ protected function setUp() { $field_storage = array( 'field_name' => $this->fieldName, - 'entity_type' => $this->entityType, + 'entity_type' => $this->entityTypeId, 'type' => 'test_field', 'cardinality' => 4, ); entity_create('field_storage_config', $field_storage)->save(); - $this->fieldStorage = FieldStorageConfig::load($this->entityType . '.' . $this->fieldName); + $this->fieldStorage = FieldStorageConfig::load($this->entityTypeId . '.' . $this->fieldName); $field = array( 'field_storage' => $this->fieldStorage, - 'bundle' => $this->entityType, + 'bundle' => $this->entityTypeId, ); entity_create('field_config', $field)->save(); - $this->field = FieldConfig::load($this->entityType . '.' . $field['bundle'] . '.' . $this->fieldName); + $this->field = FieldConfig::load($this->entityTypeId . '.' . $field['bundle'] . '.' . $this->fieldName); - entity_get_form_display($this->entityType, $this->entityType, 'default') + entity_get_form_display($this->entityTypeId, $this->entityTypeId, 'default') ->setComponent($this->fieldName) ->save(); @@ -95,8 +95,8 @@ function testFieldFormTranslationRevisions() { $this->drupalLogin($web_user); // Prepare the field translations. - field_test_entity_info_translatable($this->entityType, TRUE); - $entity = entity_create($this->entityType); + field_test_entity_info_translatable($this->entityTypeId, TRUE); + $entity = entity_create($this->entityTypeId); $available_langcodes = array_flip(array_keys($this->container->get('language_manager')->getLanguages())); $field_name = $this->fieldStorage->getName(); @@ -113,7 +113,7 @@ function testFieldFormTranslationRevisions() { "{$field_name}[0][value]" => $entity->{$field_name}->value, 'revision' => TRUE, ); - $this->drupalPostForm($this->entityType . '/manage/' . $entity->id(), $edit, t('Save')); + $this->drupalPostForm($this->entityTypeId . '/manage/' . $entity->id(), $edit, t('Save')); // Check translation revisions. $this->checkTranslationRevisions($entity->id(), $entity->getRevisionId(), $available_langcodes); @@ -126,7 +126,7 @@ function testFieldFormTranslationRevisions() { */ private function checkTranslationRevisions($id, $revision_id, $available_langcodes) { $field_name = $this->fieldStorage->getName(); - $entity = entity_revision_load($this->entityType, $revision_id); + $entity = entity_revision_load($this->entityTypeId, $revision_id); foreach ($available_langcodes as $langcode => $value) { $passed = $entity->getTranslation($langcode)->{$field_name}->value == $value + 1; $this->assertTrue($passed, format_string('The @language translation for revision @revision was correctly stored', array('@language' => $langcode, '@revision' => $entity->getRevisionId())));