Skip to content

Commit

Permalink
Override the default hashing cost in BcryptTest
Browse files Browse the repository at this point in the history
  • Loading branch information
PHLAK committed Dec 16, 2024
1 parent 938bdab commit f7303fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/Methods/BcryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ public function it_can_be_hashed_with_bcrypt(): void
{
$string = new Twine\Str('john pinkerton');

$bcrypt = $string->bcrypt();
$bcrypt = $string->bcrypt(['cost' => 12]);

$this->assertInstanceOf(Twine\Str::class, $bcrypt);
$this->assertMatchesRegularExpression('/\$2y\$10\$[a-zA-Z0-9+.\/]{53}/', (string) $bcrypt);
$this->assertMatchesRegularExpression('/\$2y\$12\$[a-zA-Z0-9+.\/]{53}/', (string) $bcrypt);
}

#[Test]
public function a_multibyte_string_can_be_hashed_with_bcrypt(): void
{
$string = new Twine\Str('宮本 茂');

$bcrypt = $string->bcrypt();
$bcrypt = $string->bcrypt(['cost' => 12]);

$this->assertInstanceOf(Twine\Str::class, $bcrypt);
$this->assertMatchesRegularExpression('/\$2y\$10\$[a-zA-Z0-9+.\/]{53}/', (string) $bcrypt);
$this->assertMatchesRegularExpression('/\$2y\$12\$[a-zA-Z0-9+.\/]{53}/', (string) $bcrypt);
}

#[Test]
Expand Down

0 comments on commit f7303fb

Please sign in to comment.