function AssetQueryStringTest::testResetGet

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Asset/AssetQueryStringTest.php \Drupal\KernelTests\Core\Asset\AssetQueryStringTest::testResetGet()

@covers ::get @covers ::reset

File

core/tests/Drupal/KernelTests/Core/Asset/AssetQueryStringTest.php, line 23

Class

AssetQueryStringTest
Tests the asset query string functionality.

Namespace

Drupal\KernelTests\Core\Asset

Code

public function testResetGet() : void {
    $state = $this->container
        ->get('state');
    // Return a fixed timestamp.
    $time = $this->createStub(TimeInterface::class);
    $time->method('getRequestTime')
        ->willReturn(1683246590);
    $queryString = new AssetQueryString($state, $time);
    $queryString->reset();
    $value = $queryString->get();
    $this->assertEquals('ru5tdq', $value);
}

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