Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / phpunit / includes / password / LayeredParameterizedPasswordTest.php
blob773f033abb8c13174ef8131b65c226c0a3d2392d
1 <?php
3 class LayeredParameterizedPasswordTest extends PasswordTestCase {
4 protected function getTypeConfigs() {
5 return [
6 'testLargeLayeredTop' => [
7 'class' => 'LayeredParameterizedPassword',
8 'types' => [
9 'testLargeLayeredBottom',
10 'testLargeLayeredBottom',
11 'testLargeLayeredBottom',
12 'testLargeLayeredBottom',
13 'testLargeLayeredFinal',
16 'testLargeLayeredBottom' => [
17 'class' => 'Pbkdf2Password',
18 'algo' => 'sha512',
19 'cost' => 1024,
20 'length' => 512,
22 'testLargeLayeredFinal' => [
23 'class' => 'BcryptPassword',
24 'cost' => 5,
29 public static function providePasswordTests() {
30 // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
31 return [
33 true,
34 ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC',
35 'testPassword123'
38 // @codingStandardsIgnoreEnd
41 /**
42 * @covers LayeredParameterizedPassword::partialCrypt
44 public function testLargeLayeredPartialUpdate() {
45 /** @var ParameterizedPassword $partialPassword */
46 $partialPassword = $this->passwordFactory->newFromType( 'testLargeLayeredBottom' );
47 $partialPassword->crypt( 'testPassword123' );
49 /** @var LayeredParameterizedPassword $totalPassword */
50 $totalPassword = $this->passwordFactory->newFromType( 'testLargeLayeredTop' );
51 $totalPassword->partialCrypt( $partialPassword );
53 $this->assertTrue( $totalPassword->equals( 'testPassword123' ) );