Passed
Pull Request — master (#13)
by Simon
01:52
created

YubikeyFormTest::testAuthenticatorName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Firesphere\YubiAuth\Tests;
4
5
6
use Firesphere\YubiAuth\Forms\YubikeyForm;
7
use SilverStripe\Control\Controller;
8
use SilverStripe\Control\HTTPRequest;
9
use SilverStripe\Control\Session;
10
use SilverStripe\Dev\SapphireTest;
11
12
class YubikeyFormTest extends SapphireTest
13
{
14
    /**
15
     * @var YubikeyForm;
16
     */
17
    protected $form;
18
19
    protected function setUp()
20
    {
21
        parent::setUp();
22
        $backURL = '/test/url';
23
        $request = new HTTPRequest('GET', '/', ['BackURL' => $backURL]);
24
        $request->setSession(new Session(['hi' => 'bye']));
25
        $controller = new Controller();
26
        $controller->setRequest($request);
27
        $this->form = YubikeyForm::create($controller);
28
    }
29
30
    public function testBackURL()
31
    {
32
        $fields = $this->form->getFormFields();
33
34
        $this->assertNotNull($fields->dataFieldByName('BackURL'));
35
36
    }
37
38
    public function testAuthenticatorName()
39
    {
40
        $this->assertEquals('Yubikey authentication', $this->form->getAuthenticatorName());
41
    }
42
43
}