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
Bug
introduced
by
![]() |
|||
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 |