You are here

public function CryptTest::testHashBase64 in Drupal 8

Same name and namespace in other branches
  1. 9 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 39

Class

CryptTest
Tests random byte generation.

Namespace

Drupal\Tests\Component\Utility

Code

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