wiki.techinc.nl/tests/phpunit/includes/password/Pbkdf2PasswordFallbackTest.php
Tim Starling a9911b2582 Improve test coverage in includes/password
From 21% to 82%.

* Added missing @covers, broadened @covers where appropriate.
* Added tests for some code that lacked them.
* Added a parameter to control the use of hash_pbkdf2() so that the pure
  PHP fallback could be tested. In the non-fallback test, force the use
  of the extension, and mark it skipped if it is not installed.

Bug: T167003
Change-Id: I987e1a89ec343907f4ead7f6192b2d4deb58ac16
2017-06-07 14:28:11 +10:00

29 lines
750 B
PHP

<?php
/**
* @group large
* @covers Pbkdf2Password
*/
class Pbkdf2PasswordFallbackTest extends PasswordTestCase {
protected function getTypeConfigs() {
return [
'pbkdf2' => [
'class' => 'Pbkdf2Password',
'algo' => 'sha256',
'cost' => '10000',
'length' => '128',
'use-hash-extension' => false,
],
];
}
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" ],
];
}
}