function CryptTest::testHashBase64

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/CryptTest.php \Drupal\Tests\Component\Utility\CryptTest::testHashBase64()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/CryptTest.php \Drupal\Tests\Component\Utility\CryptTest::testHashBase64()
  3. 10 core/tests/Drupal/Tests/Component/Utility/CryptTest.php \Drupal\Tests\Component\Utility\CryptTest::testHashBase64()

Tests hash generation.

@dataProvider providerTestHashBase64 @covers ::hashBase64

Parameters

string $data: Data to hash.

string $expected_hash: Expected result from hashing $data.

File

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

Class

CryptTest
Tests random byte generation.

Namespace

Drupal\Tests\Component\Utility

Code

public function testHashBase64($data, $expected_hash) : void {
    $hash = Crypt::hashBase64($data);
    $this->assertEquals($expected_hash, $hash, 'The correct hash was not calculated.');
}

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