You are here

public function PasswordTest::testPrepareValueUsingHashedPassword in Feeds 8.3

Tests preparing a sha512 hashed password.

@covers ::prepareValue

File

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

Class

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

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testPrepareValueUsingHashedPassword() {
  $target = $this
    ->instantiatePlugin([
    'pass_encryption' => Password::PASS_SHA512,
  ]);
  $hasher = new PhpassHashedPassword(1);
  $hash = $hasher
    ->hash(md5('password'));
  $method = $this
    ->getProtectedClosure($target, 'prepareValue');
  $values = [
    'value' => $hash,
  ];
  $method(0, $values);
  $this
    ->assertSame($hash, $values['value']);
  $this
    ->assertSame(TRUE, $values['pre_hashed']);
}