Argon2HasherTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testArgon2Hashing() 0 13 2
1
<?php
2
3
namespace KoenHoeijmakers\LaravelArgon2\Tests\Unit;
4
5
use PHPUnit\Framework\TestCase;
6
use KoenHoeijmakers\LaravelArgon2\Argon2Hasher;
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
}
25