Test Failed
Push — master ( 1374e0...cfebc0 )
by michael
03:12
created

U2fAuthenticationRequiredEventTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 11
dl 0
loc 32
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testMustAuthenticate() 0 3 1
A testAbort() 0 4 1
A testUser() 0 3 1
A testName() 0 4 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\Authentication;
13
14
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
15
use Mbarbey\U2fSecurityBundle\Model\User\U2fUser;
16
use Mbarbey\U2fSecurityBundle\Event\Authentication\U2fAuthenticationRequiredEvent;
17
18
class U2fAuthenticationRequiredEventTest extends TestCase
19
{
20
    private $event;
21
    private $user;
22
23
    public function setUp()
24
    {
25
        $this->user = new U2fUser();
26
27
        $this->event = new U2fAuthenticationRequiredEvent($this->user);
28
    }
29
30
    public function testName()
31
    {
32
        $this->assertEquals('u2f.authentication.required', U2fAuthenticationRequiredEvent::getName());
33
        $this->assertEquals('u2f.authentication.required', $this->event->getName());
34
    }
35
36
    public function testUser()
37
    {
38
        $this->assertEquals($this->user, $this->event->getUser());
39
    }
40
41
    public function testMustAuthenticate()
42
    {
43
        $this->assertTrue($this->event->mustAuthenticate());
44
    }
45
46
    public function testAbort()
47
    {
48
        $this->event->abort();
49
        $this->assertFalse($this->event->mustAuthenticate());
50
    }
51
}
52