You are here

public function LibraryDiscoveryCollectorTest::testResolveCacheMiss in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryCollectorTest::testResolveCacheMiss()

Tests the resolve cache miss function.

@covers ::resolveCacheMiss

File

core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php, line 88

Class

LibraryDiscoveryCollectorTest
@coversDefaultClass \Drupal\Core\Asset\LibraryDiscoveryCollector @group Asset

Namespace

Drupal\Tests\Core\Asset

Code

public function testResolveCacheMiss() {
  $this->activeTheme = $this
    ->getMockBuilder('Drupal\\Core\\Theme\\ActiveTheme')
    ->disableOriginalConstructor()
    ->getMock();
  $this->themeManager
    ->expects($this
    ->exactly(3))
    ->method('getActiveTheme')
    ->willReturn($this->activeTheme);
  $this->activeTheme
    ->expects($this
    ->once())
    ->method('getName')
    ->willReturn('kitten_theme');
  $this->libraryDiscoveryCollector = new LibraryDiscoveryCollector($this->cache, $this->lock, $this->libraryDiscoveryParser, $this->themeManager);
  $this->libraryDiscoveryParser
    ->expects($this
    ->once())
    ->method('buildByExtension')
    ->with('test')
    ->willReturn($this->libraryData);
  $this
    ->assertSame($this->libraryData, $this->libraryDiscoveryCollector
    ->get('test'));
  $this
    ->assertSame($this->libraryData, $this->libraryDiscoveryCollector
    ->get('test'));
}