4 require_once
'Services/Password/classes/encoders/class.ilBcryptPhpPasswordEncoder.php';
5 require_once
'Services/Password/test/ilPasswordBaseTest.php';
41 if(version_compare(phpversion(),
'5.5.0',
'<'))
43 $this->markTestSkipped(
'Requires PHP >= 5.5.0');
53 for($i = 4; $i <= 31; $i++)
68 $this->assertTrue((
int)$default_costs_encoder->getCosts() > 4 && (int)$default_costs_encoder->getCosts() < 32);
71 'cost' => self::VALID_COSTS
73 $this->assertInstanceOf(
'ilBcryptPhpPasswordEncoder', $encoder);
74 $this->assertEquals(self::VALID_COSTS, $encoder->getCosts());
84 $this->assertEquals(4, $encoder->
getCosts());
121 $encoder->
setCosts(self::VALID_COSTS);
123 $this->assertTrue($encoder->
isPasswordValid($encoded_password, self::PASSWORD,
''));
124 $this->assertFalse($encoder->
isPasswordValid($encoded_password, self::WRONG_PASSWORD,
''));
135 $encoder->
setCosts(self::VALID_COSTS);
144 $encoder->
setCosts(self::VALID_COSTS);
145 $this->assertFalse($encoder->
isPasswordValid(
'encoded', str_repeat(
'a', 5000),
''));
153 $this->assertEquals(
'bcryptphp', $encoder->
getName());
164 $this->assertTrue($costs_default > 4 && $costs_default < 32);
165 $this->assertTrue($costs_target > 4 && $costs_target < 32);
166 $this->assertInternalType(
'int', $costs_default);
167 $this->assertInternalType(
'int', $costs_target);
168 $this->assertNotEquals($costs_default, $costs_target);
184 $raw = self::PASSWORD;
testCostsCanBeDeterminedDynamically(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated
testCostsCannotBeSetAboveRange(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated ilPasswordException
testEncoderDoesNotRelyOnSalts(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated
benchmarkCost($time_target=0.05)
skipIfPhpVersionIsNotSupported()
requiresSalt()
{Returns whether or not the encoder requires a salt.boolean}
testCostsCanBeSetInRange($costs, ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated costsProvider
isPasswordValid($encoded, $raw, $salt)
{Checks a raw password against an encoded password.The raw password has to be injected into the encod...
testInstanceCanBeCreated()
requiresReencoding($encoded)
{Returns whether or not the a encoded password needs to be re-encoded.string boolean} ...
Create styles array
The data for the language used.
testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated ilPasswordException
testNameShouldBeBcryptPhp(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated
testPasswordShouldBeCorrectlyEncodedAndVerified(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated
testReencodingIsDetectedWhenNecessary(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated
testCostsCannotBeSetBelowRange(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated ilPasswordException
encodePassword($raw, $salt)
{Encodes the raw password.The password to encode The salt string The encoded password} ...
assertException($exception_class)
testCostsCanBeRetrievedWhenCostsAreSet(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated
testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength(ilBcryptPhpPasswordEncoder $encoder)
testInstanceCanBeCreated