function BrowserTestBaseTest::testGetRandomGeneratorPropertyDeprecation

Tests the deprecation of accessing the randomGenerator property directly.

@group legacy

File

core/tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php, line 100

Class

BrowserTestBaseTest
@coversDefaultClass \Drupal\Tests\BrowserTestBase @group Test

Namespace

Drupal\Tests\Core\Test

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.