config = new TwoFactorConfiguration(); } public function test_getSerials() { $provider = new WebauthnProvider($this->config); $this->assertNotEmpty($provider->getSerials('user', 'password')); } public function test_isShowSubmitButton() { $provider = new WebauthnProvider($this->config); $this->assertFalse($provider->isShowSubmitButton()); } public function test_hasCustomInputForm() { $provider = new WebauthnProvider($this->config); $this->assertTrue($provider->hasCustomInputForm()); } public function test_addCustomInput() { $this->config->twoFactorAuthenticationOptional = true; $manager = $this ->getMockBuilder(WebauthnManager::class) ->setMethods(array('isRegistered')) ->getMock(); $manager->method('isRegistered')->willReturn(false); $provider = $this ->getMockBuilder(WebauthnProvider::class) ->setConstructorArgs(array($this->config)) ->setMethods(array('getWebauthnManager')) ->getMock(); $provider->method('getWebauthnManager')->willReturn($manager); $row = new \htmlResponsiveRow(); $provider->addCustomInput($row, 'userDn'); $tabindex = 0; ob_start(); $row->generateHTML(null, array(), array(), false, $tabindex, 'none'); $html = ob_get_contents(); ob_end_clean(); $this->assertContains('skip_webauthn', $html); } }