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\Entity\Key; |
||||||
13 | |||||||
14 | use Symfony\Bundle\FrameworkBundle\Tests\TestCase; |
||||||
15 | use Mbarbey\U2fSecurityBundle\Model\Key\U2fKey; |
||||||
16 | use Mbarbey\U2fSecurityBundle\Model\User\U2fUser; |
||||||
17 | |||||||
18 | class U2fKeyTest extends TestCase |
||||||
19 | { |
||||||
20 | public function testKeyHandle() |
||||||
21 | { |
||||||
22 | $key = $this->getKey(); |
||||||
23 | $this->assertNull($key->keyHandle); |
||||||
24 | |||||||
25 | $key->keyHandle = 'test1'; |
||||||
26 | $this->assertEquals($key->keyHandle, 'test1'); |
||||||
27 | $this->assertEquals($key->getKeyHandle(), 'test1'); |
||||||
28 | |||||||
29 | $key->setKeyHandle('test2'); |
||||||
30 | $this->assertEquals($key->keyHandle, 'test2'); |
||||||
31 | $this->assertEquals($key->getKeyHandle(), 'test2'); |
||||||
32 | } |
||||||
33 | |||||||
34 | public function testPublicKey() |
||||||
35 | { |
||||||
36 | $key = $this->getKey(); |
||||||
37 | $this->assertNull($key->publicKey); |
||||||
38 | |||||||
39 | $key->publicKey = 'test1'; |
||||||
40 | $this->assertEquals($key->publicKey, 'test1'); |
||||||
41 | $this->assertEquals($key->getPublicKey(), 'test1'); |
||||||
42 | |||||||
43 | $key->setPublicKey('test2'); |
||||||
44 | $this->assertEquals($key->publicKey, 'test2'); |
||||||
45 | $this->assertEquals($key->getPublicKey(), 'test2'); |
||||||
46 | } |
||||||
47 | |||||||
48 | public function testCertificate() |
||||||
49 | { |
||||||
50 | $key = $this->getKey(); |
||||||
51 | $this->assertNull($key->certificate); |
||||||
52 | |||||||
53 | $key->certificate = 'test1'; |
||||||
54 | $this->assertEquals($key->certificate, 'test1'); |
||||||
55 | $this->assertEquals($key->getCertificate(), 'test1'); |
||||||
56 | |||||||
57 | $key->setCertificate('test2'); |
||||||
58 | $this->assertEquals($key->certificate, 'test2'); |
||||||
59 | $this->assertEquals($key->getCertificate(), 'test2'); |
||||||
60 | } |
||||||
61 | |||||||
62 | public function testCounter() |
||||||
63 | { |
||||||
64 | $key = $this->getKey(); |
||||||
65 | $this->assertNull($key->counter); |
||||||
66 | |||||||
67 | $key->counter = 100; |
||||||
68 | $this->assertEquals($key->counter, 100); |
||||||
69 | $this->assertEquals($key->getCounter(), 100); |
||||||
70 | |||||||
71 | $key->setCounter(200); |
||||||
72 | $this->assertEquals($key->counter, 200); |
||||||
73 | $this->assertEquals($key->getCounter(), 200); |
||||||
74 | } |
||||||
75 | |||||||
76 | public function testUser() |
||||||
77 | { |
||||||
78 | $key = $this->getKey(); |
||||||
79 | $this->assertNull($key->getUser()); |
||||||
0 ignored issues
–
show
|
|||||||
80 | |||||||
81 | $user = $this->getMockForAbstractClass(U2fUser::class); |
||||||
82 | $key->setUser($user); |
||||||
0 ignored issues
–
show
The method
setUser() does not exist on PHPUnit\Framework\MockObject\MockObject .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||||||
83 | $this->assertEquals($key->getUser(), $user); |
||||||
84 | } |
||||||
85 | |||||||
86 | protected function getKey() |
||||||
87 | { |
||||||
88 | return $this->getMockForAbstractClass(U2fKey::class); |
||||||
89 | } |
||||||
90 | } |
||||||
91 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.