Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion spec/system/framework/Facades/Facades.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
use BlitzPHP\View\View as ViewView;
use DI\NotFoundException;

use function Kahlan\expect;

describe('Facades', function (): void {
describe('Facade', function (): void {
it('Accessor retourne un objet', function (): void {
Expand Down Expand Up @@ -206,7 +208,7 @@ protected static function accessor(): string
Log::debug('test file ' . __FILE__);

/** @var SplFileInfo $file */
$file = last(Fs::files(storage_path('logs')));
$file = last(Fs::files(storage_path('logs')));
expect($file->getContents())->toMatch(fn($actual) => str_contains($actual, 'test file ' . __FILE__));
});
});
Expand Down
44 changes: 26 additions & 18 deletions spec/system/framework/Security/Hashing/Hasher.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,35 @@
});

it(': Argon', function (): void {
$hasher = new ArgonHandler();
$value = $hasher->make('password');

expect($value)->not->toBe('password');
expect($hasher->check('password', $value))->toBeTruthy();
expect($hasher->needsRehash($value))->toBeFalsy();
expect($hasher->needsRehash($value, ['threads' => 1]))->toBeTruthy();
expect($hasher->info($value)['algoName'])->toBe('argon2i');
expect($this->hasher->isHashed($value))->toBeTruthy();
try {
$hasher = new ArgonHandler();
$value = $hasher->make('password');

expect($value)->not->toBe('password');
expect($hasher->check('password', $value))->toBeTruthy();
expect($hasher->needsRehash($value))->toBeFalsy();
expect($hasher->needsRehash($value, ['threads' => 1]))->toBeTruthy();
expect($hasher->info($value)['algoName'])->toBe('argon2i');
expect($this->hasher->isHashed($value))->toBeTruthy();
} catch (Throwable) {
skipIf(true);
}
});

it(': Argon2id', function (): void {
$hasher = new Argon2IdHandler();
$value = $hasher->make('password');

expect($value)->not->toBe('password');
expect($hasher->check('password', $value))->toBeTruthy();
expect($hasher->needsRehash($value))->toBeFalsy();
expect($hasher->needsRehash($value, ['threads' => 1]))->toBeTruthy();
expect($hasher->info($value)['algoName'])->toBe('argon2id');
expect($this->hasher->isHashed($value))->toBeTruthy();
try {
$hasher = new Argon2IdHandler();
$value = $hasher->make('password');

expect($value)->not->toBe('password');
expect($hasher->check('password', $value))->toBeTruthy();
expect($hasher->needsRehash($value))->toBeFalsy();
expect($hasher->needsRehash($value, ['threads' => 1]))->toBeTruthy();
expect($hasher->info($value)['algoName'])->toBe('argon2id');
expect($this->hasher->isHashed($value))->toBeTruthy();
} catch (Throwable) {
skipIf(true);
}
});
});

Expand Down