Completed
Pull Request — develop (#619)
by
unknown
04:25
created

AuthenticationProviderDummy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Simple dummy provider for test cases.
4
 */
5
namespace Graviton\SecurityBundle\Authentication\Provider;
6
7
use Symfony\Component\Security\Core\User\UserInterface;
8
9
/**
10
 * Class AirlockAuthenticationKeyConsultantProvider
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class AuthenticationProviderDummy extends AuthenticationProvider
17
{
18
19
    /**
20
     * AuthenticationProviderDummy constructor.
21
     */
22 6
    public function __construct()
23
    {
24 6
    }
25
26
    /**
27
     * Dummy loader for test case
28
     *
29
     * This method must throw UsernameNotFoundException if the user is not
30
     * found.
31
     *
32
     * @param string $username the consultants username
33
     *
34
     * @return false|UserInterface
35
     */
36 4
    public function loadUserByUsername($username)
37
    {
38 4
        if ($username !== 'testUsername') {
39 4
            return false;
40
        }
41
42
        /** @var UserInterface $user */
43 4
        $user = new \stdClass();
44 4
        $user->id = 123;
45 4
        $user->username = $username;
46 4
        $user->firstName = 'aName';
47 4
        $user->lastName = 'aSurname';
48
49 4
        return $user;
50
    }
51
}
52