Passed
Branch unit (c10797)
by Koen
02:29 queued 20s
created

Argon2HasherTest::testArgon2Hashing()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 0
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
}
25