MediaWiki REL1_31
LayeredParameterizedPasswordTest.php
Go to the documentation of this file.
1<?php
2
8 protected function getTypeConfigs() {
9 return [
10 'testLargeLayeredTop' => [
11 'class' => LayeredParameterizedPassword::class,
12 'types' => [
13 'testLargeLayeredBottom',
14 'testLargeLayeredBottom',
15 'testLargeLayeredBottom',
16 'testLargeLayeredBottom',
17 'testLargeLayeredFinal',
18 ],
19 ],
20 'testLargeLayeredBottom' => [
21 'class' => Pbkdf2Password::class,
22 'algo' => 'sha512',
23 'cost' => 1024,
24 'length' => 512,
25 ],
26 'testLargeLayeredFinal' => [
27 'class' => BcryptPassword::class,
28 'cost' => 5,
29 ]
30 ];
31 }
32
33 protected function getValidTypes() {
34 return [ 'testLargeLayeredFinal' ];
35 }
36
37 public static function providePasswordTests() {
38 // phpcs:disable Generic.Files.LineLength
39 return [
40 [
41 true,
42 ':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',
43 'testPassword123'
44 ],
45 ];
46 // phpcs:enable
47 }
48
54 $partialPassword = $this->passwordFactory->newFromType( 'testLargeLayeredBottom' );
55 $partialPassword->crypt( 'testPassword123' );
56
58 $totalPassword = $this->passwordFactory->newFromType( 'testLargeLayeredTop' );
59 $totalPassword->partialCrypt( $partialPassword );
60
61 $this->assertTrue( $totalPassword->equals( 'testPassword123' ) );
62 }
63}
LayeredParameterizedPassword Password.
testLargeLayeredPartialUpdate()
LayeredParameterizedPassword::partialCrypt.
getTypeConfigs()
Return an array of configs to be used for this class's password type.
static providePasswordTests()
An array of tests in the form of (bool, string, string), where the first element is whether the secon...