function LibraryDiscoveryCollectorTest::testResolveCacheMiss

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryCollectorTest::testResolveCacheMiss()
  2. 10 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryCollectorTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryCollectorTest::testResolveCacheMiss()
  3. 11.x 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 105

Class

LibraryDiscoveryCollectorTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Asset%21LibraryDiscoveryCollector.php/class/LibraryDiscoveryCollector/9" title="A CacheCollector implementation for building library extension info." class="local">\Drupal\Core\Asset\LibraryDiscoveryCollector</a> @group Asset

Namespace

Drupal\Tests\Core\Asset

Code

public function testResolveCacheMiss() {
    $this->activeTheme = $this->getMockBuilder(ActiveTheme::class)
        ->disableOriginalConstructor()
        ->getMock();
    $this->themeManager
        ->expects($this->exactly(5))
        ->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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.