You are here

public function CryptTest::testRandomBytes in Drupal 8

Tests random byte generation.

@covers ::randomBytes @expectedDeprecation Drupal\Component\Utility\Crypt::randomBytes() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Use PHP's built-in random_bytes() function instead. See https://www.drupal.org/node/3057191 @group legacy

File

core/tests/Drupal/Tests/Component/Utility/CryptTest.php, line 24

Class

CryptTest
Tests random byte generation.

Namespace

Drupal\Tests\Component\Utility

Code

public function testRandomBytes() {
  $this
    ->assertSame(16, strlen(Crypt::randomBytes(16)));
}