You are here

public function HashTest::testHashWithOverride in Tamper 8

Test the hash functionality.

File

tests/src/Unit/Plugin/Tamper/HashTest.php, line 58

Class

HashTest
Tests the hash plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testHashWithOverride() {
  $plugin = new Hash([
    Hash::SETTING_OVERRIDE => TRUE,
  ], 'hash', [], $this
    ->getMockSourceDefinition());
  $hashed_values = md5(serialize([
    'title' => 'Yay title!',
    'body' => 'Yay body!',
    'foo' => 'bar',
  ]));
  $this
    ->assertEquals($hashed_values, $plugin
    ->tamper('', $this
    ->getMockItem()));
  $this
    ->assertEquals($hashed_values, $plugin
    ->tamper('foo', $this
    ->getMockItem()));
}