DummyPasswordEnricherTest::testPassword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace DMK\MKSamlAuth\Tests\Unit\Enricher;
5
6
use DMK\MKSamlAuth\Enricher\DummyPasswordEnricher;
7
use DMK\MKSamlAuth\Model\FrontendUser;
8
use PHPUnit\Framework\TestCase;
9
10
class DummyPasswordEnricherTest extends TestCase
11
{
12
    /**
13
     * @var DummyPasswordEnricher
14
     */
15
    private $enricher;
16
17
    protected function setUp()
18
    {
19
        $this->enricher = new DummyPasswordEnricher();
20
    }
21
22
    public function testProcess()
23
    {
24
        $user = new FrontendUser([
25
            'password' => null
26
        ]);
27
28
        $this->enricher->process($user, []);
29
30
        static::assertNotNull($user->getProperty('password'));
31
    }
32
33
    public function testPassword()
34
    {
35
        $user = new FrontendUser([]);
36
        $user->setProperty('password', 'foo');
37
38
        $this->enricher->process($user, []);
39
40
        static::assertSame('foo', $user->getProperty('password'));
41
    }
42
43
    public function testPasswordNotExists()
44
    {
45
        $user = new FrontendUser([]);
46
47
        $this->enricher->process($user, []);
48
49
        static::assertNotNull($user->getProperty('password'));
50
    }
51
}
52