DummyPasswordEnricherTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A testPassword() 0 8 1
A testPasswordNotExists() 0 7 1
A testProcess() 0 9 1
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