AvailableMethodDetailsTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 25
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testJsonSerialize() 0 5 1
A setUp() 0 6 1
1
<?php
2
3
namespace SilverStripe\MFA\Tests\State;
4
5
use PHPUnit_Framework_MockObject_MockObject;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\MFA\Method\Handler\RegisterHandlerInterface;
8
use SilverStripe\MFA\Method\MethodInterface;
9
use SilverStripe\MFA\State\AvailableMethodDetails;
10
11
class AvailableMethodDetailsTest extends SapphireTest
12
{
13
    /**
14
     * @var MethodInterface|PHPUnit_Framework_MockObject_MockObject
15
     */
16
    protected $method;
17
18
    /**
19
     * @var AvailableMethodDetails
20
     */
21
    protected $details;
22
23
    protected function setUp()
24
    {
25
        parent::setUp();
26
27
        $this->method = $this->createMock(MethodInterface::class);
28
        $this->details = new AvailableMethodDetails($this->method);
29
    }
30
31
    public function testJsonSerialize()
32
    {
33
        $this->method->expects($this->once())->method('getName')->willReturn('Backup Codes');
34
        $result = json_encode($this->details);
35
        $this->assertContains('Backup Codes', $result);
36
    }
37
}
38