1
|
|
|
<?php |
2
|
|
|
namespace Isign\Tests\Login; |
3
|
|
|
|
4
|
|
|
use Isign\Login\SmartId; |
5
|
|
|
use Isign\QueryInterface; |
6
|
|
|
use Isign\Tests\TestCase; |
7
|
|
|
|
8
|
|
|
class SmartIdTest extends TestCase |
9
|
|
|
{ |
10
|
|
View Code Duplication |
public function testGetFields() |
|
|
|
|
11
|
|
|
{ |
12
|
|
|
$method = new SmartId('xxxxxxxxxxx', 'LT'); |
13
|
|
|
|
14
|
|
|
$result = $method->getFields(); |
15
|
|
|
|
16
|
|
|
$this->assertArrayHasKey('code', $result); |
17
|
|
|
$this->assertArrayHasKey('country', $result); |
18
|
|
|
$this->assertSame('xxxxxxxxxxx', $result['code']); |
19
|
|
|
$this->assertSame('LT', $result['country']); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function testGetAction() |
23
|
|
|
{ |
24
|
|
|
$method = new SmartId('', ''); |
25
|
|
|
$this->assertSame('smartid/login', $method->getAction()); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function testGetMethod() |
29
|
|
|
{ |
30
|
|
|
$method = new SmartId('', ''); |
31
|
|
|
$this->assertSame(QueryInterface::POST, $method->getMethod()); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function testCreateResult() |
35
|
|
|
{ |
36
|
|
|
$method = new SmartId('', ''); |
37
|
|
|
$this->assertInstanceOf('Isign\Login\SmartIdResult', $method->createResult()); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function testHasValidationConstraints() |
41
|
|
|
{ |
42
|
|
|
$method = new SmartId('', ''); |
43
|
|
|
$collection = $method->getValidationConstraints(); |
44
|
|
|
|
45
|
|
|
$this->assertInstanceOf( |
46
|
|
|
'Symfony\Component\Validator\Constraints\Collection', |
47
|
|
|
$collection |
48
|
|
|
); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.