You are here

public function PasswordTest::testPrepareValueUsingMd5PasswordThatFails in Feeds 8.3

Tests preparing a md5 hashed password that fails.

@covers ::prepareValue

File

tests/src/Unit/Feeds/Target/PasswordTest.php, line 109

Class

PasswordTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\Password @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValueUsingMd5PasswordThatFails() {
  $md5 = md5('password');
  $this->passwordHasher
    ->hash($md5)
    ->willReturn(FALSE);
  $target = $this
    ->instantiatePlugin([
    'pass_encryption' => Password::PASS_MD5,
  ]);
  $method = $this
    ->getProtectedClosure($target, 'prepareValue');
  $values = [
    'value' => $md5,
  ];
  $this
    ->expectException(TargetValidationException::class);
  $method(0, $values);
}