core/modules/block/src/Tests/BlockViewBuilderTest.php | 1 + core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php | 14 +++++++------- .../Tests/Core/Config/Entity/ConfigEntityStorageTest.php | 4 ++-- core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php index b2dde86..c5523f3 100644 --- a/core/modules/block/src/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php @@ -246,6 +246,7 @@ public function testBlockViewBuilderAlter() { \Drupal::state()->set('block_test_view_alter_cache_tag', $alter_add_tag); $expected_tags = Cache::mergeTags($default_tags, array($alter_add_tag)); $build = $this->getBlockRenderArray(); + sort($build['#cache']['tags']); $this->assertIdentical($expected_tags, $build['#cache']['tags'], 'An altered cacheable block has the expected cache tags.'); $cid = drupal_render_cid_create(array('#cache' => array('keys' => $expected_keys))); $this->assertIdentical(drupal_render($build), ''); diff --git a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php index 14454dd..486dc20 100644 --- a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php @@ -222,7 +222,7 @@ function testCacheClearByCacheTag() { // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user against the language "en". $cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . 'en'); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "en".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "en".'); // Assert that no toolbar cache exists for admin_user against the // language "fr". @@ -242,7 +242,7 @@ function testCacheClearByCacheTag() { // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user against the language "fr". $cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . 'fr'); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "fr".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "fr".'); // Log in the admin_user_2 user. We will use this user as a control to // verify that clearing a cache tag for admin_user does not clear the cache @@ -255,7 +255,7 @@ function testCacheClearByCacheTag() { // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user_2 against the language "en". $cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'en'); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "en".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_2_id); //, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "en".'); // Request a page in 'fr' to create the cache. $this->drupalGet('fr/test-page'); @@ -263,7 +263,7 @@ function testCacheClearByCacheTag() { // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user against the language "fr". $cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'fr'); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "fr".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "fr".'); // Log in admin_user and clear the caches for this user using a tag. $this->drupalLogin($this->admin_user); @@ -285,12 +285,12 @@ function testCacheClearByCacheTag() { // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user_2 against the language "en". $cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'en'); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "en".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "en".'); // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user_2 against the language "fr". $cache = $toolbarCache->get('toolbar_' . $admin_user_2_id . ':' . 'fr'); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "fr".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_2_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user_2 against the language "fr".'); } /** @@ -374,7 +374,7 @@ function testLocaleTranslationSubtreesHashCacheClear() { // Assert that a cache tag in the toolbar cache under the key "user" exists // for admin_user against the language "xx". $cache = $toolbarCache->get('toolbar_' . $admin_user_id . ':' . $langcode); - $this->assertEqual($cache->tags[0], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "xx".'); + $this->assertEqual($cache->tags[2], 'user:' . $admin_user_id, 'A cache tag in the toolbar cache under the key "user" exists for admin_user against the language "xx".'); // Get a baseline hash for the admin menu subtrees before translating one // of the menu link items. diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index a343e9e..6bf678f 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -300,8 +300,8 @@ public function testSaveUpdate(EntityInterface $entity) { $this->cacheBackend->expects($this->once()) ->method('invalidateTags') ->with(array( - $this->entityTypeId . 's', // List cache tag. $this->entityTypeId . ':foo', // Own cache tag. + $this->entityTypeId . 's', // List cache tag. )); $this->configFactory->expects($this->exactly(2)) @@ -360,8 +360,8 @@ public function testSaveRename(ConfigEntityInterface $entity) { $this->cacheBackend->expects($this->once()) ->method('invalidateTags') ->with(array( - $this->entityTypeId . 's', // List cache tag. $this->entityTypeId .':bar', // Own cache tag. + $this->entityTypeId . 's', // List cache tag. )); $this->configFactory->expects($this->once()) diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php index 8b91074..1fc8d7b 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -397,8 +397,8 @@ public function testPostSave() { $this->cacheBackend->expects($this->at(1)) ->method('invalidateTags') ->with(array( - $this->entityTypeId . 's', // List cache tag. $this->entityTypeId . ':' . $this->values['id'], // Own cache tag. + $this->entityTypeId . 's', // List cache tag. )); // This method is internal, so check for errors on calling it only.