function UnitTestCaseTest::testGetRandomGeneratorPropertyDeprecation

Tests the deprecation of accessing the randomGenerator property directly.

@group legacy

File

core/tests/Drupal/Tests/UnitTestCaseTest.php, line 65

Class

UnitTestCaseTest
Tests for the UnitTestCase class.

Namespace

Drupal\Tests

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.