function CryptTest::testHashBase64

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/CryptTest.php \Drupal\Tests\Component\Utility\CryptTest::testHashBase64()
  2. 10 core/tests/Drupal/Tests/Component/Utility/CryptTest.php \Drupal\Tests\Component\Utility\CryptTest::testHashBase64()
  3. 11.x 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.');
}

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