Issues (13)

tests/unit/YubikeyFormTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Firesphere\YubiAuth\Tests;
4
5
use Firesphere\YubiAuth\Forms\YubikeyForm;
6
use SilverStripe\Control\Controller;
7
use SilverStripe\Control\HTTPRequest;
8
use SilverStripe\Control\Session;
9
use SilverStripe\Dev\SapphireTest;
10
11
class YubikeyFormTest extends SapphireTest
12
{
13
    /**
14
     * @var YubikeyForm;
15
     */
16
    protected $form;
17
18
    public function testBackURL()
19
    {
20
        $fields = $this->form->getFormFields();
21
22
        $this->assertNotNull($fields->dataFieldByName('BackURL'));
0 ignored issues
show
The method dataFieldByName() does not exist on Firesphere\YubiAuth\Forms\YubikeyForm. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $this->assertNotNull($fields->/** @scrutinizer ignore-call */ dataFieldByName('BackURL'));
Loading history...
23
    }
24
25
    public function testAuthenticatorName()
26
    {
27
        $this->assertEquals('Yubikey authentication', $this->form->getAuthenticatorName());
28
    }
29
30
    protected function setUp()
31
    {
32
        parent::setUp();
33
        $backURL = '/test/url';
34
        $request = new HTTPRequest('GET', '/', ['BackURL' => $backURL]);
35
        $request->setSession(new Session(['hi' => 'bye']));
36
        $controller = new Controller();
37
        $controller->setRequest($request);
38
        $this->form = YubikeyForm::create($controller);
39
    }
40
}
41