Completed
Push — master ( 450ed3...cc0280 )
by michael
02:49
created

U2fRegistrationSuccessEventTest   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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testUser() 0 3 1
A testKey() 0 3 1
A testName() 0 6 1
A setUp() 0 6 1
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\Registration;
13
14
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
15
use Mbarbey\U2fSecurityBundle\Model\User\U2fUser;
16
use Mbarbey\U2fSecurityBundle\Model\Key\U2fKey;
17
use Mbarbey\U2fSecurityBundle\Event\Registration\U2fRegistrationSuccessEvent;
18
19
class U2fRegistrationSuccessEventTest 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 U2fRegistrationSuccessEvent($this->user, $this->key);
31
    }
32
33
    public function testName()
34
    {
35
        $name = 'u2f.registration.success';
36
37
        $this->assertEquals(U2fRegistrationSuccessEvent::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