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

U2fAuthenticationSuccessEventTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 28
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testName() 0 4 1
A testUser() 0 3 1
A testKey() 0 3 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\U2fAuthenticationSuccessEvent;
17
use Mbarbey\U2fSecurityBundle\Tests\Entity\Key\U2fKeyTest;
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 = new U2fUser();
28
        $this->key = new U2fKeyTest();
29
30
        $this->event = new U2fAuthenticationSuccessEvent($this->user, $this->key);
0 ignored issues
show
Bug introduced by
$this->key of type Mbarbey\U2fSecurityBundl...s\Entity\Key\U2fKeyTest is incompatible with the type Mbarbey\U2fSecurityBundl...del\Key\U2fKeyInterface expected by parameter $key of Mbarbey\U2fSecurityBundl...essEvent::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
        $this->event = new U2fAuthenticationSuccessEvent($this->user, /** @scrutinizer ignore-type */ $this->key);
Loading history...
31
    }
32
33
    public function testName()
34
    {
35
        $this->assertEquals('u2f.authentication.success', U2fAuthenticationSuccessEvent::getName());
36
        $this->assertEquals('u2f.authentication.success', $this->event->getName());
37
    }
38
39
    public function testUser()
40
    {
41
        $this->assertEquals($this->user, $this->event->getUser());
42
    }
43
44
    public function testKey()
45
    {
46
        $this->assertEquals($this->key, $this->event->getKey());
47
    }
48
}
49