Issue #2529442 by neclimdul: Random phpunit failures in EntityUnitTest

8.0.x
Alex Pott 2015-07-09 00:11:10 +01:00
parent eb70a1c1cc
commit a87f47dbba
1 changed files with 5 additions and 1 deletions

View File

@ -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());
}