diff --git a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php index cb5cd87..2079d48 100644 --- a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php @@ -1529,7 +1529,9 @@ protected function cacheGet($ids) { // Call the load hooks on the entities loaded from the persistent cache. if (!empty($entities_from_cache)) { $this->invokeLoadHook($entities_from_cache); - $entities = array_merge($entities, $entities_from_cache); + foreach ($entities_from_cache as $id => $entity) { + $entities[$id] = $entity; + } } } diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php index 23e7fd1..c120377 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php @@ -269,15 +269,15 @@ function testFieldAttachCache() { $entity = clone($entity_init); $entity->{$this->field_name_2} = $values; $entity->save(); - $cid = "field:$entity_type:" . $entity->id(); + $cid = "entity:$entity_type:" . $entity->id(); $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry on insert'); // Load, and check that a cache entry is present with the expected values. $controller = $this->container->get('entity.manager')->getStorageController($entity->entityType()); $controller->resetCache(); $controller->load($entity->id()); - $cache = cache('field')->get($cid); - $this->assertEqual($cache->data[$langcode][$this->field_name_2], $values, 'Cached: correct cache entry on load'); + $cache = cache('entity')->get($cid); + $this->assertEqual($cache->data['values'][$this->field_name_2][$langcode], $values, 'Cached: correct cache entry on load'); // Update with different values, and check that the cache entry is wiped. $values = $this->_generateTestFieldValues($this->field_2->getFieldCardinality()); @@ -287,13 +287,13 @@ function testFieldAttachCache() { )); $entity->{$this->field_name_2} = $values; $entity->save(); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry on update'); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry on update'); // Load, and check that a cache entry is present with the expected values. $controller->resetCache(); $controller->load($entity->id()); - $cache = cache('field')->get($cid); - $this->assertEqual($cache->data[$langcode][$this->field_name_2], $values, 'Cached: correct cache entry on load'); + $cache = cache('entity')->get($cid); + $this->assertEqual($cache->data['values'][$this->field_name_2][$langcode], $values, 'Cached: correct cache entry on load'); // Create a new revision, and check that the cache entry is wiped. $entity = entity_create($entity_type, array( @@ -309,12 +309,12 @@ function testFieldAttachCache() { // Load, and check that a cache entry is present with the expected values. $controller->resetCache(); $controller->load($entity->id()); - $cache = cache('field')->get($cid); - $this->assertEqual($cache->data[$langcode][$this->field_name_2], $values, 'Cached: correct cache entry on load'); + $cache = cache('entity')->get($cid); + $this->assertEqual($cache->data['values'][$this->field_name_2][$langcode], $values, 'Cached: correct cache entry on load'); // Delete, and check that the cache entry is wiped. $entity->delete(); - $this->assertFalse(cache('field')->get($cid), 'Cached: no cache entry after delete'); + $this->assertFalse(cache('entity')->get($cid), 'Cached: no cache entry after delete'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php index d581147..b9ed58f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php @@ -61,11 +61,7 @@ function testUpdateAccess() { $this->assertResponse(200); // Access the update page as user 1. - $user1 = user_load(1); - $user1->pass_raw = user_password(); - $user1->pass = $this->container->get('password')->hash(trim($user1->pass_raw)); - db_query("UPDATE {users} SET pass = :pass WHERE uid = :uid", array(':pass' => $user1->getPassword(), ':uid' => $user1->id())); - $this->drupalLogin($user1); + $this->drupalLogin($this->root_user); $this->drupalGet($this->update_url, array('external' => TRUE)); $this->assertResponse(200); } diff --git a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php index 6309c98..9e19654 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextWithSummaryItemTest.php @@ -126,38 +126,36 @@ function testProcessedCache() { // Load the entity and check that the field cache contains the expected // data. $entity = entity_load($entity_type, $entity->id()); - $cache = cache('field')->get("field:$entity_type:" . $entity->id()); - $this->assertEqual($cache->data, array( + $cache = cache('entity')->get("entity:$entity_type:" . $entity->id()); + $this->assertEqual($cache->data['values']['summary_field'], array( Language::LANGCODE_DEFAULT => array( - 'summary_field' => array( - 0 => array( - 'value' => $value, - 'summary' => $summary, - 'format' => 'plain_text', - 'processed' => $value, - 'summary_processed' => $summary, - ), + 0 => array( + 'value' => $value, + 'summary' => $summary, + 'format' => 'plain_text', + 'processed' => $value, + 'summary_processed' => $summary, ), ), )); // Inject fake processed values into the cache to make sure that these are // used as-is and not re-calculated when the entity is loaded. - $data = array( + $data = $cache->data; + $data['values']['summary_field'] = array( Language::LANGCODE_DEFAULT => array( - 'summary_field' => array( - 0 => array( - 'value' => $value, - 'summary' => $summary, - 'format' => 'plain_text', - 'processed' => 'Cached processed value', - 'summary_processed' => 'Cached summary processed value', - ), + 0 => array( + 'value' => $value, + 'summary' => $summary, + 'format' => 'plain_text', + 'processed' => 'Cached processed value', + 'summary_processed' => 'Cached summary processed value', ), ), ); - cache('field')->set("field:$entity_type:" . $entity->id(), $data); - $entity = entity_load($entity_type, $entity->id(), TRUE); + \Drupal::entityManager()->getStorageController($entity_type)->resetCache(); + cache('entity')->set("entity:$entity_type:" . $entity->id(), $data); + $entity = entity_load($entity_type, $entity->id()); $this->assertEqual($entity->summary_field->processed, 'Cached processed value'); $this->assertEqual($entity->summary_field->summary_processed, 'Cached summary processed value');