function AssetResolverTest::providerAttachedJsAssets

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php \Drupal\Tests\Core\Asset\AssetResolverTest::providerAttachedJsAssets()

File

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

Class

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

Namespace

Drupal\Tests\Core\Asset

Code

public static function providerAttachedJsAssets() {
    $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,
            2,
        ],
        '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,
            4,
        ],
    ];
}

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