TableDiffFormatter: Don't repeatedly call array_shift()
[lhc/web/wiklou.git] / tests / phpunit / includes / password / LayeredParameterizedPasswordTest.php
1 <?php
2
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',
14 ],
15 ],
16 'testLargeLayeredBottom' => [
17 'class' => 'Pbkdf2Password',
18 'algo' => 'sha512',
19 'cost' => 1024,
20 'length' => 512,
21 ],
22 'testLargeLayeredFinal' => [
23 'class' => 'BcryptPassword',
24 'cost' => 5,
25 ]
26 ];
27 }
28
29 public static function providePasswordTests() {
30 // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong
31 return array(
32 array( true, ':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', 'testPassword123' ),
33 );
34 // @codingStandardsIgnoreEnd
35 }
36
37 /**
38 * @covers LayeredParameterizedPassword::partialCrypt
39 */
40 public function testLargeLayeredPartialUpdate() {
41 /** @var ParameterizedPassword $partialPassword */
42 $partialPassword = $this->passwordFactory->newFromType( 'testLargeLayeredBottom' );
43 $partialPassword->crypt( 'testPassword123' );
44
45 /** @var LayeredParameterizedPassword $totalPassword */
46 $totalPassword = $this->passwordFactory->newFromType( 'testLargeLayeredTop' );
47 $totalPassword->partialCrypt( $partialPassword );
48
49 $this->assertTrue( $totalPassword->equals( 'testPassword123' ) );
50 }
51 }