function KernelTestBaseTest::testGetRandomGeneratorPropertyDeprecation

Tests the deprecation of accessing the randomGenerator property directly.

@group legacy

File

core/tests/Drupal/KernelTests/KernelTestBaseTest.php, line 414

Class

KernelTestBaseTest
@coversDefaultClass \Drupal\KernelTests\KernelTestBase

Namespace

Drupal\KernelTests

Code

public function testGetRandomGeneratorPropertyDeprecation() : void {
    $this->expectDeprecation('Accessing the randomGenerator property is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use getRandomGenerator() instead. See https://www.drupal.org/node/3358445');
    // We purposely test accessing an undefined property here. We need to tell
    // PHPStan to ignore that.
    // @phpstan-ignore-next-line
    $this->assertInstanceOf(Random::class, $this->randomGenerator);
}

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