You are here

public function AssetResolverTest::providerAttachedAssets in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php \Drupal\Tests\Core\Asset\AssetResolverTest::providerAttachedAssets()

File

core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php, line 138
Contains \Drupal\Tests\Core\Asset\AssetResolverTest.

Class

AssetResolverTest
@coversDefaultClass \Drupal\Core\Asset\AssetResolver @group Asset

Namespace

Drupal\Tests\Core\Asset

Code

public function providerAttachedAssets() {
  $time = time();
  return [
    'same libraries, different timestamps' => [
      (new AttachedAssets())
        ->setAlreadyLoadedLibraries([])
        ->setLibraries([
        'core/drupal',
      ])
        ->setSettings([
        'currentTime' => $time,
      ]),
      (new AttachedAssets())
        ->setAlreadyLoadedLibraries([])
        ->setLibraries([
        'core/drupal',
      ])
        ->setSettings([
        'currentTime' => $time + 100,
      ]),
      1,
    ],
    'different libraries, same timestamps' => [
      (new AttachedAssets())
        ->setAlreadyLoadedLibraries([])
        ->setLibraries([
        'core/drupal',
      ])
        ->setSettings([
        'currenttime' => $time,
      ]),
      (new AttachedAssets())
        ->setAlreadyLoadedLibraries([])
        ->setLibraries([
        'core/drupal',
        'core/jquery',
      ])
        ->setSettings([
        'currentTime' => $time,
      ]),
      2,
    ],
  ];
}