AvailableMethodDetailsTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
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