From a87f47dbba8b8f329ee16fe5ad92f0ac783285e7 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Thu, 9 Jul 2015 00:11:10 +0100 Subject: [PATCH] Issue #2529442 by neclimdul: Random phpunit failures in EntityUnitTest --- core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php index d58c054af5a..929ff004c65 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -502,7 +502,11 @@ class EntityUnitTest extends UnitTestCase { // that. $this->entity->addCacheTags(['additional_cache_tag']); - $this->assertEquals(['additional_cache_tag', $this->entityTypeId . ':' . 1], $this->entity->getCacheTags()); + // EntityTypeId is random so it can shift order. We need to duplicate the + // sort from \Drupal\Core\Cache\Cache::mergeTags(). + $tags = ['additional_cache_tag', $this->entityTypeId . ':' . 1]; + sort($tags); + $this->assertEquals($tags, $this->entity->getCacheTags()); $this->assertEquals([$this->entityTypeId . ':' . 1], $this->entity->getCacheTagsToInvalidate()); }