File tree Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 11/.idea
22/vendor
3+ composer.lock
Original file line number Diff line number Diff line change 33 "description" : " Argon2 implementation" ,
44 "require" : {
55 "php" : " ^7.2" ,
6- "illuminate/hashing" : " 5.0 - 5.5"
6+ "illuminate/hashing" : " 5.0 - 5.5" ,
7+ "phpunit/phpunit" : " ^7.0"
78 },
89 "license" : " MIT" ,
910 "authors" : [
1617 "psr-4" : {
1718 "KoenHoeijmakers\\ LaravelArgon2\\ " : " src/"
1819 }
20+ },
21+ "autoload-dev" : {
22+ "psr-4" : {
23+ "KoenHoeijmakers\\ LaravelArgon2\\ Tests\\ " : " tests/"
24+ }
1925 }
2026}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <phpunit backupGlobals =" false"
3+ backupStaticAttributes =" false"
4+ colors =" true"
5+ convertErrorsToExceptions =" true"
6+ convertNoticesToExceptions =" true"
7+ convertWarningsToExceptions =" true"
8+ processIsolation =" false"
9+ stopOnFailure =" false"
10+ syntaxCheck =" false"
11+ >
12+ <testsuites >
13+ <testsuite name =" Laravel Argon2 test suite" >
14+ <directory suffix =" .php" >./tests/</directory >
15+ </testsuite >
16+ </testsuites >
17+ </phpunit >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace KoenHoeijmakers \LaravelArgon2 \Tests \Unit ;
4+
5+ use KoenHoeijmakers \LaravelArgon2 \Argon2Hasher ;
6+ use PHPUnit \Framework \TestCase ;
7+
8+ class Argon2HasherTest extends TestCase
9+ {
10+ public function testArgon2Hashing ()
11+ {
12+ if (! defined ('PASSWORD_ARGON2I ' )) {
13+ $ this ->markTestSkipped ('PHP not compiled with argon2 hashing support. ' );
14+ }
15+
16+ $ hasher = new Argon2Hasher ();
17+
18+ $ value = $ hasher ->make ('password ' );
19+ $ this ->assertNotSame ('password ' , $ value );
20+ $ this ->assertTrue ($ hasher ->check ('password ' , $ value ));
21+ $ this ->assertFalse ($ hasher ->needsRehash ($ value ));
22+ $ this ->assertTrue ($ hasher ->needsRehash ($ value , ['threads ' => 1 ]));
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments