Passed
Branch master (17d5a9)
by michael
08:14
created

U2fAuthenticationSuccessEventTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 4
1
<?php
2
3
/*
4
 * This file is part of the U2F Security bundle.
5
 *
6
 * (c) Michael Barbey <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mbarbey\U2fSecurityBundle\Tests\Event\Authentication;
13
14
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
15
use Mbarbey\U2fSecurityBundle\Model\User\U2fUser;
16
use Mbarbey\U2fSecurityBundle\Event\Authentication\U2fAuthenticationSuccessEvent;
17
use Mbarbey\U2fSecurityBundle\Model\Key\U2fKey;
18
19
class U2fAuthenticationSuccessEventTest extends TestCase
20
{
21
    private $event;
22
    private $user;
23
    private $key;
24
25
    public function setUp()
26
    {
27
        $this->user = $this->getMockForAbstractClass(U2fUser::class);
28
        $this->key = $this->getMockForAbstractClass(U2fKey::class);
29
30
        $this->event = new U2fAuthenticationSuccessEvent($this->user, $this->key);
31
    }
32
33
    public function testName()
34
    {
35
        $name = 'u2f.authentication.success';
36
37
        $this->assertEquals(U2fAuthenticationSuccessEvent::getName(), $name);
38
        $this->assertEquals($this->event->getName(), $name);
39
    }
40
41
    public function testUser()
42
    {
43
        $this->assertEquals($this->event->getUser(), $this->user);
44
    }
45
46
    public function testKey()
47
    {
48
        $this->assertEquals($this->event->getKey(), $this->key);
49
    }
50
}
51