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

YubikeyFormTest::testBackURL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 9.4285
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
    protected $form;
16
17
    protected function setUp()
18
    {
19
        parent::setUp();
20
        $backURL = '/test/url';
21
        $request = new HTTPRequest('GET', '/', ['BackURL' => $backURL]);
22
        $request->setSession(new Session(['hi' => 'bye']));
23
        $controller = new Controller();
24
        $controller->setRequest($request);
25
        $this->form = YubikeyForm::create($controller);
26
    }
27
28
    public function testBackURL()
29
    {
30
        $fields = $this->form->getFormFields();
31
32
        $this->assertNotNull($fields->dataFieldByName('BackURL'));
33
34
    }
35
36
    public function testAuthenticatorName()
37
    {
38
        $this->assertEquals('Yubikey authentication', $this->form->getAuthenticatorName());
39
    }
40
41
}