public function testEncodeNoPasswordNoInteraction() { $statusCode =
$this->passwordHasherCommandTester->
execute([ ],
['interactive' => false
]);
$this->
assertStringContainsString('[ERROR] The password must not be empty.',
$this->passwordHasherCommandTester->
getDisplay());
$this->
assertEquals(1,
$statusCode);
} public function testEncodePasswordBcrypt() { $this->
setupBcrypt();
$this->passwordHasherCommandTester->
execute([ 'password' => 'password',
'user-class' => 'Custom\Class\Bcrypt\User',
],
['interactive' => false
]);
$output =
$this->passwordHasherCommandTester->
getDisplay();
$this->
assertStringContainsString('Password hashing succeeded',
$output);
$hasher =
new NativePasswordHasher(null, null, 17, \PASSWORD_BCRYPT
);
preg_match('# Password hash\s{1,}([\w+\/$.]+={0,2})\s+#',
$output,
$matches);
$hash =
$matches[1
];