diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php index 5993669..245d8f3 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php @@ -34,6 +34,13 @@ class LibraryDiscoveryCollectorTest extends UnitTestCase { protected $libraryDiscoveryParser; /** + * The mock cache contexts object. + * + * @var \Drupal\Core\Cache\CacheContexts|\PHPUnit_Framework_MockObject_MockObject + */ + protected $cacheContexts; + + /** * The library discovery collector under test. * * @var \Drupal\Core\Asset\LibraryDiscoveryCollector @@ -65,8 +72,15 @@ protected function setUp() { $this->libraryDiscoveryParser = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscoveryParser') ->disableOriginalConstructor() ->getMock(); + $this->cacheContexts = $this->getMockBuilder('Drupal\Core\Cache\CacheContexts') + ->disableOriginalConstructor() + ->getMock(); + $this->cacheContexts->expects($this->any()) + ->method('convertTokensToKeys') + ->with(['library_info', 'cache_context.user.roles', 'cache_context.is_admin_route']) + ->will($this->returnValue(['library_info'])); - $this->libraryDiscoveryCollector = new LibraryDiscoveryCollector($this->cache, $this->lock, $this->libraryDiscoveryParser); + $this->libraryDiscoveryCollector = new LibraryDiscoveryCollector($this->cache, $this->lock, $this->libraryDiscoveryParser, $this->cacheContexts); } /**