rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / password / LayeredParameterizedPasswordTest.php
blobcf96d0673c71c49cbd4c165a471c514df4f04e0f
1 <?php
3 /**
4 * @covers LayeredParameterizedPassword
5 * @covers Password
6 */
7 class LayeredParameterizedPasswordTest extends PasswordTestCase {
8 protected function getTypeConfigs() {
9 return [
10 'testLargeLayeredTop' => [
11 'class' => 'LayeredParameterizedPassword',
12 'types' => [
13 'testLargeLayeredBottom',
14 'testLargeLayeredBottom',
15 'testLargeLayeredBottom',
16 'testLargeLayeredBottom',
17 'testLargeLayeredFinal',
20 'testLargeLayeredBottom' => [
21 'class' => 'Pbkdf2Password',
22 'algo' => 'sha512',
23 'cost' => 1024,
24 'length' => 512,
26 'testLargeLayeredFinal' => [
27 'class' => 'BcryptPassword',
28 'cost' => 5,
33 protected function getValidTypes() {
34 return [ 'testLargeLayeredFinal' ];
37 public static function providePasswordTests() {
38 // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
39 return [
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'
46 // @codingStandardsIgnoreEnd
49 /**
50 * @covers LayeredParameterizedPassword::partialCrypt
52 public function testLargeLayeredPartialUpdate() {
53 /** @var ParameterizedPassword $partialPassword */
54 $partialPassword = $this->passwordFactory->newFromType( 'testLargeLayeredBottom' );
55 $partialPassword->crypt( 'testPassword123' );
57 /** @var LayeredParameterizedPassword $totalPassword */
58 $totalPassword = $this->passwordFactory->newFromType( 'testLargeLayeredTop' );
59 $totalPassword->partialCrypt( $partialPassword );
61 $this->assertTrue( $totalPassword->equals( 'testPassword123' ) );