function AssetResolverTest::testGetJsAssets

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php \Drupal\Tests\Core\Asset\AssetResolverTest::testGetJsAssets()
  2. 8.9.x core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php \Drupal\Tests\Core\Asset\AssetResolverTest::testGetJsAssets()
  3. 10 core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php \Drupal\Tests\Core\Asset\AssetResolverTest::testGetJsAssets()

@covers ::getJsAssets @dataProvider providerAttachedJsAssets

File

core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php, line 206

Class

AssetResolverTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Asset%21AssetResolver.php/class/AssetResolver/11.x" title="The default asset resolver." class="local">\Drupal\Core\Asset\AssetResolver</a> @group Asset

Namespace

Drupal\Tests\Core\Asset

Code

public function testGetJsAssets(AttachedAssetsInterface $assets_a, AttachedAssetsInterface $assets_b, $expected_js_cache_item_count, $expected_multilingual_js_cache_item_count) : void {
    $this->libraryDiscovery
        ->expects($this->any())
        ->method('getLibraryByName')
        ->willReturnOnConsecutiveCalls($this->libraries['drupal'], $this->libraries['drupal'], $this->libraries['jquery'], $this->libraries['drupal'], $this->libraries['drupal'], $this->libraries['jquery']);
    $this->assetResolver
        ->getJsAssets($assets_a, FALSE, $this->english);
    $this->assetResolver
        ->getJsAssets($assets_b, FALSE, $this->english);
    $this->assertCount($expected_js_cache_item_count, $this->cache
        ->getAllCids());
    $this->assetResolver
        ->getJsAssets($assets_a, FALSE, $this->japanese);
    $this->assetResolver
        ->getJsAssets($assets_b, FALSE, $this->japanese);
    $this->assertCount($expected_multilingual_js_cache_item_count, $this->cache
        ->getAllCids());
}

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