wiki.techinc.nl/tests/phpunit/includes/password/Pbkdf2PasswordTest.php
Max Semenik 9c5174669e Unbreak Pbkdf2PasswordTest
Due to https://github.com/sebastianbergmann/phpunit/issues/3459 it was
looking for a wrong function name and was skipping the test even when PHP
support was present.

Change-Id: I2508f192a76275286e95bd6a06e4628d98b11737
2019-01-02 00:21:13 -08:00

36 lines
1,022 B
PHP

<?php
/**
* @group large
* @covers Pbkdf2Password
* @covers Password
* @covers ParameterizedPassword
*/
class Pbkdf2PasswordTest extends PasswordTestCase {
public function setUp() {
parent::setUp();
// Can't be done with annotations due to
// https://github.com/sebastianbergmann/phpunit/issues/3459
if ( !function_exists( 'hash_pbkdf2' ) ) {
$this->markTestSkipped( 'function hash_pbkdf2 is required' );
}
}
protected function getTypeConfigs() {
return [ 'pbkdf2' => [
'class' => Pbkdf2Password::class,
'algo' => 'sha256',
'cost' => '10000',
'length' => '128',
] ];
}
public static function providePasswordTests() {
return [
[ true, ":pbkdf2:sha1:1:20:c2FsdA==:DGDID5YfDnHzqbUkr2ASBi/gN6Y=", 'password' ],
[ true, ":pbkdf2:sha1:2:20:c2FsdA==:6mwBTcctb4zNHtkqzh1B8NjeiVc=", 'password' ],
[ true, ":pbkdf2:sha1:4096:20:c2FsdA==:SwB5AbdlSJq+rUnZJvch0GWkKcE=", 'password' ],
[ true, ":pbkdf2:sha1:4096:16:c2EAbHQ=:Vvpqp1VICZ3MN9fwNCXgww==", "pass\x00word" ],
];
}
}