You are here

public function PasswordTest::testPrepareValueUsingMd5Password in Feeds 8.3

Tests preparing a md5 hashed password.

@covers ::prepareValue

File

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

Class

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

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValueUsingMd5Password() {
  $md5 = md5('password');
  $this->passwordHasher
    ->hash($md5)
    ->willReturn('$S$5psAlzq7nesZ7uXLLMRPHI45GL3PaadvAP9.kmYHIh6QMDq0EFhc');
  $target = $this
    ->instantiatePlugin([
    'pass_encryption' => Password::PASS_MD5,
  ]);
  $method = $this
    ->getProtectedClosure($target, 'prepareValue');
  $values = [
    'value' => $md5,
  ];
  $method(0, $values);
  $this
    ->assertSame('U$S$5psAlzq7nesZ7uXLLMRPHI45GL3PaadvAP9.kmYHIh6QMDq0EFhc', $values['value']);
  $this
    ->assertSame(TRUE, $values['pre_hashed']);
}