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

U2fAuthenticationFailureEventTest::testName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
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\Event\Authentication\U2fAuthenticationFailureEvent;
16
use Mbarbey\U2fSecurityBundle\Model\User\U2fUser;
17
18
class U2fAuthenticationFailureEventTest extends TestCase
19
{
20
    private $event;
21
    private $user;
22
    private $error;
23
    private $counter;
24
25
    public function setUp()
26
    {
27
        $this->user = $this->getMockForAbstractClass(U2fUser::class);
28
        $this->error = new \Exception();
29
        $this->counter = rand(10, 100);
30
31
        $this->event = new U2fAuthenticationFailureEvent($this->user, $this->error, $this->counter);
32
    }
33
34
    public function testName()
35
    {
36
        $name = 'u2f.authentication.failure';
37
38
        $this->assertEquals(U2fAuthenticationFailureEvent::getName(), $name);
39
        $this->assertEquals($this->event->getName(), $name);
40
    }
41
42
    public function testUser()
43
    {
44
        $this->assertEquals($this->event->getUser(), $this->user);
45
    }
46
47
    public function testError()
48
    {
49
        $this->assertEquals($this->event->getError(), $this->error);
50
    }
51
52
    public function testFailureCounter()
53
    {
54
        $this->assertEquals($this->event->getFailureCounter(), $this->counter);
55
    }
56
}
57