improve code

This commit is contained in:
Daniel Seifert 2022-12-13 22:24:33 +01:00
parent 4183ebcf99
commit 68b9f53c14
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
81 changed files with 271 additions and 218 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea
.php_cs.cache
src/tests/.phpunit.result.cache
src/tests/reports/

13
.php-cs-fixer.php Normal file
View File

@ -0,0 +1,13 @@
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP74Migration' => true,
'@PSR12' => true
])
->setFinder($finder)
;

View File

@ -39,6 +39,7 @@
"ext-json": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19",
"phpstan/phpstan": "^1.8"
},
"autoload": {

View File

@ -78,7 +78,7 @@ class d3user_webauthn extends AdminDetailsController
public function requestNewCredential(): void
{
try {
$this->setPageType( 'requestnew' );
$this->setPageType('requestnew');
$this->setAuthnRegister();
} catch (Exception|ContainerExceptionInterface|NotFoundExceptionInterface|DoctrineDriverException $e) {
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e->getMessage());
@ -97,16 +97,16 @@ class d3user_webauthn extends AdminDetailsController
{
try {
$error = Registry::getRequest()->getRequestEscapedParameter('error');
if ( strlen((string) $error) ) {
if (strlen((string) $error)) {
/** @var WebauthnCreateException $e */
$e = oxNew(WebauthnCreateException::class, $error);
throw $e;
}
$credential = Registry::getRequest()->getRequestEscapedParameter('credential');
if ( strlen((string) $credential) ) {
if (strlen((string) $credential)) {
$webauthn = $this->d3GetMockableOxNewObject(Webauthn::class);
$webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter( 'keyname' ) );
$webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter('keyname'));
}
} catch (WebauthnException $e) {
$this->d3GetMockableLogger()->error($e->getDetailedErrorMessage(), ['UserId' => $this->getEditObjectId()]);

View File

@ -118,7 +118,8 @@ class d3webauthnadminlogin extends AdminController
public function d3AssertAuthn(): ?string
{
try {
$login = $this->d3GetMockableOxNewObject(WebauthnLogin::class,
$login = $this->d3GetMockableOxNewObject(
WebauthnLogin::class,
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('credential'),
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('error')
);

View File

@ -125,7 +125,7 @@ class d3_account_webauthn extends AccountController
$error = Registry::getRequest()->getRequestEscapedParameter('error');
if (strlen((string) $error)) {
/** @var WebauthnCreateException $e */
$e = oxNew( WebauthnCreateException::class, $error);
$e = oxNew(WebauthnCreateException::class, $error);
throw $e;
}
@ -135,7 +135,7 @@ class d3_account_webauthn extends AccountController
$webauthn->saveAuthn($credential, Registry::getRequest()->getRequestEscapedParameter('keyname'));
}
} catch (WebauthnException $e) {
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay( $e );
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e);
}
}

View File

@ -49,7 +49,7 @@ class PublicKeyCredential extends BaseModel
public function setName(string $name): void
{
$this->assign([
'name' => $name
'name' => $name,
]);
}
@ -67,7 +67,7 @@ class PublicKeyCredential extends BaseModel
public function setCredentialId(string $credentialId): void
{
$this->assign([
'credentialid' => base64_encode($credentialId)
'credentialid' => base64_encode($credentialId),
]);
}
@ -85,7 +85,7 @@ class PublicKeyCredential extends BaseModel
public function setUserId(string $userId): void
{
$this->assign([
'oxuserid' => $userId
'oxuserid' => $userId,
]);
}
@ -103,7 +103,7 @@ class PublicKeyCredential extends BaseModel
public function setCredential(PublicKeyCredentialSource $credential): void
{
$this->assign([
'credential' => base64_encode(serialize($credential))
'credential' => base64_encode(serialize($credential)),
]);
}

View File

@ -26,19 +26,19 @@ class WebauthnException extends StandardException
public $detailedErrorMessage = null;
public function __construct( $sMessage = "not set", $iCode = 0, Exception $previous = null )
public function __construct($sMessage = "not set", $iCode = 0, Exception $previous = null)
{
$this->setDetailedErrorMessage($sMessage);
$this->d3CallMockableFunction(
[
StandardException::class,
'__construct'
'__construct',
],
[
$this->getErrorMessageTranslator()->translateError($sMessage, $this->getRequestType()),
$iCode,
$previous
$previous,
]
);
}

View File

@ -29,11 +29,11 @@ class RelyingPartyEntity extends PublicKeyCredentialRpEntity
$this->d3CallMockableFunction(
[
PublicKeyCredentialRpEntity::class,
'__construct'
'__construct',
],
[
$this->getActiveShop()->getFieldData('oxname'),
$this->getRPShopUrl()
$this->getRPShopUrl(),
]
);
}

View File

@ -39,12 +39,12 @@ class UserEntity extends PublicKeyCredentialUserEntity
$this->d3CallMockableFunction(
[
PublicKeyCredentialUserEntity::class,
'__construct'
'__construct',
],
[
strtolower($user->getFieldData('oxusername')),
$user->getId(),
$user->getFieldData('oxfname') . ' ' . $user->getFieldData('oxlname')
$user->getFieldData('oxfname') . ' ' . $user->getFieldData('oxlname'),
]
);
}

View File

@ -56,7 +56,7 @@ class Webauthn
!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ||
!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on' ||
in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || // is localhost
(isset($_SERVER['REMOTE_ADDR']) && preg_match('/.*\.localhost$/mi', $_SERVER['REMOTE_ADDR']) ) // localhost is TLD
(isset($_SERVER['REMOTE_ADDR']) && preg_match('/.*\.localhost$/mi', $_SERVER['REMOTE_ADDR'])) // localhost is TLD
) {
return true;
}
@ -123,7 +123,7 @@ class Webauthn
*/
protected function jsonEncode($creationOptions)
{
return json_encode($creationOptions,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
return json_encode($creationOptions, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
/**
@ -225,9 +225,9 @@ class Webauthn
try {
$this->getServer()->loadAndCheckAssertionResponse(
html_entity_decode( $response ),
html_entity_decode($response),
$this->d3GetMockableRegistryObject(Session::class)
->getVariable( self::SESSION_ASSERTION_OPTIONS ),
->getVariable(self::SESSION_ASSERTION_OPTIONS),
$userEntity,
$serverRequest
);

View File

@ -59,7 +59,7 @@ class WebauthnErrors
}
if (strtoupper($msg) === self::UNSECURECONNECTION) {
return $lang->translateString($msg);
return $lang->translateString($msg);
}
return $lang->translateString('D3_WEBAUTHN_ERR_TECHNICALERROR', null, true);
@ -72,7 +72,7 @@ class WebauthnErrors
public function getErrIdFromMessage(string $msg): string
{
if (is_int(strpos($msg, ':'))) {
return trim( strtolower( substr( $msg, 0, strpos( $msg, ':' ) ) ) );
return trim(strtolower(substr($msg, 0, strpos($msg, ':'))));
}
return trim(strtolower($msg));

View File

@ -16,7 +16,7 @@ $sLangName = 'Deutsch';
// -------------------------------
// RESOURCE IDENTIFIER = STRING
// -------------------------------
$aLang = array(
$aLang = [
'charset' => 'UTF-8',
'PAGE_TITLE_D3WEBAUTHNLOGIN' => 'Passwortloses Anmelden',
@ -47,4 +47,4 @@ $aLang = array(
'D3_WEBAUTHN_ERR_UNSECURECONNECTION' => 'Die Verwendung von Sicherheitsschlüsseln ist nur bei lokalen oder gesicherten Verbindungen (https) möglich.',
'D3_WEBAUTHN_ERR_LOGINPROHIBITED' => 'Die Anmeldung mit Sicherheitsschlüssel ist aus technischen Gründen derzeit leider nicht möglich. Bitte verwenden Sie statt dessen Ihr Passwort.',
'D3_WEBAUTHN_ERR_NOTLOADEDUSER' => "Kann keine Anmeldedaten von nicht geladenem Kundenkonto beziehen.",
);
];

View File

@ -56,5 +56,5 @@ $aLang = [
'<p>Ist Ihr Shop unter verschiedenen Subdomains erreichbar, können Sie hier die Hauptdomain angeben, die zur Registrierung verwendet werden soll. Beachten Sie bitte, '.
'dass die hier angegebene Adresse mit der des Shopaufrufs übereinstimmen muss. Shopfremde Adressen werden bei der Verwendung abgelehnt.</p>'.
'<p>Bleibt das Feld leer, wird die Adresse des aktuellen Shopaufrufs verwendet. Bei Verwendung unterschiedlicher Adressen muss vom Nutzer für jede Adresse eine separate '.
'Schlüsselregistrierung durchgeführt werden.</p>'
'Schlüsselregistrierung durchgeführt werden.</p>',
];

View File

@ -57,5 +57,5 @@ $aLang = [
'<p>If your shop can be reached under different subdomains, you can enter the main domain here that is to be used for registration. Please '.
'note that the address given here must match the address of the shop call. Addresses that do not match the shop will be rejected.</p>'.
'<p>If the field remains empty, the address of the current shop call is used. If different addresses are used, a separate key registration '.
'must be carried out by the user for each address.</p>'
'must be carried out by the user for each address.</p>',
];

View File

@ -15,7 +15,9 @@ namespace D3\Webauthn\Modules\Application\Component
{
use OxidEsales\Eshop\Application\Component\UserComponent;
class d3_webauthn_UserComponent_parent extends UserComponent {}
class d3_webauthn_UserComponent_parent extends UserComponent
{
}
}
namespace D3\Webauthn\Modules\Application\Controller
@ -35,44 +37,74 @@ namespace D3\Webauthn\Modules\Application\Controller
use OxidEsales\Eshop\Application\Controller\PaymentController;
use OxidEsales\Eshop\Application\Controller\UserController;
class d3_webauthn_UserController_parent extends UserController {}
class d3_webauthn_UserController_parent extends UserController
{
}
class d3_webauthn_OrderController_parent extends OrderController {}
class d3_webauthn_OrderController_parent extends OrderController
{
}
class d3_webauthn_PaymentController_parent extends PaymentController {}
class d3_webauthn_PaymentController_parent extends PaymentController
{
}
/** workarounds for missing tpl blocks (https://github.com/OXID-eSales/wave-theme/pull/124) */
class d3_AccountController_Webauthn_parent extends AccountController {}
class d3_AccountController_Webauthn_parent extends AccountController
{
}
class d3_AccountDownloadsController_Webauthn_parent extends AccountDownloadsController {}
class d3_AccountDownloadsController_Webauthn_parent extends AccountDownloadsController
{
}
class d3_AccountNoticeListController_Webauthn_parent extends AccountNoticeListController {}
class d3_AccountNoticeListController_Webauthn_parent extends AccountNoticeListController
{
}
class d3_AccountWishlistController_Webauthn_parent extends AccountWishlistController {}
class d3_AccountWishlistController_Webauthn_parent extends AccountWishlistController
{
}
class d3_AccountRecommlistController_Webauthn_parent extends AccountRecommlistController {}
class d3_AccountRecommlistController_Webauthn_parent extends AccountRecommlistController
{
}
class d3_AccountPasswordController_Webauthn_parent extends AccountPasswordController {}
class d3_AccountPasswordController_Webauthn_parent extends AccountPasswordController
{
}
class d3_AccountNewsletterController_Webauthn_parent extends AccountNewsletterController {}
class d3_AccountNewsletterController_Webauthn_parent extends AccountNewsletterController
{
}
class d3_AccountUserController_Webauthn_parent extends AccountUserController {}
class d3_AccountUserController_Webauthn_parent extends AccountUserController
{
}
class d3_AccountOrderController_Webauthn_parent extends AccountOrderController {}
class d3_AccountOrderController_Webauthn_parent extends AccountOrderController
{
}
class d3_AccountReviewController_Webauthn_parent extends AccountReviewController {}
class d3_AccountReviewController_Webauthn_parent extends AccountReviewController
{
}
}
namespace D3\Webauthn\Modules\Application\Controller\Admin
{
use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
class d3_LoginController_Webauthn_parent extends LoginController {}
class d3_LoginController_Webauthn_parent extends LoginController
{
}
}
namespace D3\Webauthn\Modules\Application\Model
{
use OxidEsales\Eshop\Application\Model\User;
class d3_User_Webauthn_parent extends User {}
class d3_User_Webauthn_parent extends User
{
}
}

View File

@ -58,12 +58,12 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
*/
public function d3WebauthnLogin(): void
{
$lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'lgn_usr');
$lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('lgn_usr');
/** @var d3_User_Webauthn $user */
$user = $this->d3GetMockableOxNewObject(User::class);
$userId = $user->d3GetLoginUserId($lgn_user);
if ( $this->d3CanUseWebauthn( $lgn_user, $userId)) {
if ($this->d3CanUseWebauthn($lgn_user, $userId)) {
if ($this->d3HasWebauthnButNotLoggedin($userId)) {
$session = $this->d3GetMockableRegistryObject(Session::class);
$session->setVariable(
@ -95,15 +95,15 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
*
* @return bool
*/
protected function d3CanUseWebauthn( $lgn_user, ?string $userId): bool
protected function d3CanUseWebauthn($lgn_user, ?string $userId): bool
{
$password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'lgn_pwd');
$password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('lgn_pwd');
return $lgn_user &&
$userId &&
false === $this->d3GetMockableRegistryObject(Session::class)
->hasVariable( WebauthnConf::WEBAUTHN_SESSION_AUTH ) &&
( ! strlen( trim( (string) $password ) ) );
->hasVariable(WebauthnConf::WEBAUTHN_SESSION_AUTH) &&
(! strlen(trim((string) $password)));
}
/**
@ -147,7 +147,8 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
public function d3AssertAuthn(): void
{
try {
$login = $this->d3GetMockableOxNewObject(WebauthnLogin::class,
$login = $this->d3GetMockableOxNewObject(
WebauthnLogin::class,
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('credential'),
$this->d3GetMockableRegistryObject(Request::class)->getRequestEscapedParameter('error')
);
@ -158,6 +159,7 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
$this->_afterLogin($this->getUser());
} catch (WebauthnGetException $e) {
$this->d3GetMockableRegistryObject(UtilsView::class)->addErrorToDisplay($e);
} catch (WebauthnLoginErrorException $e) {}
} catch (WebauthnLoginErrorException $e) {
}
}
}

View File

@ -40,7 +40,7 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
*/
public function checklogin()
{
$lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'user') ?:
$lgn_user = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('user') ?:
$this->d3GetMockableRegistryObject(Session::class)
->getVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_LOGINUSER);
@ -48,16 +48,16 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
$user = $this->d3GetMockableOxNewObject(User::class);
$userId = $user->d3GetLoginUserId($lgn_user, 'malladmin');
if ( $this->d3CanUseWebauthn( $lgn_user, $userId)) {
if ($this->d3CanUseWebauthn($lgn_user, $userId)) {
$this->d3GetMockableRegistryObject(Session::class)->setVariable(
WebauthnConf::WEBAUTHN_ADMIN_PROFILE,
$this->d3GetMockableRegistryObject(Request::class)
->getRequestEscapedParameter( 'profile')
->getRequestEscapedParameter('profile')
);
$this->d3GetMockableRegistryObject(Session::class)->setVariable(
WebauthnConf::WEBAUTHN_ADMIN_CHLANGUAGE,
$this->d3GetMockableRegistryObject(Request::class)
->getRequestEscapedParameter( 'chlanguage')
->getRequestEscapedParameter('chlanguage')
);
if ($this->hasWebauthnButNotLoggedin($userId)) {
@ -96,15 +96,15 @@ class d3_LoginController_Webauthn extends d3_LoginController_Webauthn_parent
*
* @return bool
*/
protected function d3CanUseWebauthn( $lgn_user, ?string $userId): bool
protected function d3CanUseWebauthn($lgn_user, ?string $userId): bool
{
$password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter( 'pwd');
$password = $this->d3GetMockableRegistryObject(Request::class)->getRequestParameter('pwd');
return $lgn_user &&
$userId &&
false === $this->d3GetMockableRegistryObject(Session::class)
->hasVariable( WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH ) &&
( ! strlen( trim( (string) $password ) ) );
->hasVariable(WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH) &&
(! strlen(trim((string) $password)));
}
/**

View File

@ -99,7 +99,7 @@ class d3_User_Webauthn extends d3_User_Webauthn_parent
$this,
[
$userName,
$shopId
$shopId,
]
);
}

View File

@ -139,8 +139,8 @@ class Actions
public function clearCache()
{
try {
$oUtils = $this->d3GetMockableRegistryObject( Utils::class );
$oUtils->resetTemplateCache( $this->getModuleTemplates() );
$oUtils = $this->d3GetMockableRegistryObject(Utils::class);
$oUtils->resetTemplateCache($this->getModuleTemplates());
$oUtils->resetLanguageCache();
} catch (ContainerExceptionInterface|NotFoundExceptionInterface|ModuleConfigurationNotFoundException $e) {
$this->d3GetMockableLogger()->error($e->getMessage(), [$this]);
@ -175,7 +175,7 @@ class Actions
{
/** @var $template ModuleConfiguration\Template */
return array_map(
function($template) {
function ($template) {
return $template->getTemplateKey();
},
$moduleConfiguration->getTemplates()
@ -191,7 +191,7 @@ class Actions
{
/** @var $templateBlock ModuleConfiguration\TemplateBlock */
return array_map(
function($templateBlock) {
function ($templateBlock) {
return basename($templateBlock->getShopTemplatePath());
},
$moduleConfiguration->getTemplateBlocks()

View File

@ -61,7 +61,7 @@ $logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="he
/**
* Module information
*/
$aModule = array(
$aModule = [
'id' => $sModuleId,
'title' => $logo.' Webauthn / FIDO2 Login',
'description' => [
@ -90,13 +90,13 @@ $aModule = array(
AccountNewsletterController::class => d3_AccountNewsletterController_Webauthn::class,
AccountUserController::class => d3_AccountUserController_Webauthn::class,
AccountOrderController::class => d3_AccountOrderController_Webauthn::class,
AccountReviewController::class => d3_AccountReviewController_Webauthn::class
AccountReviewController::class => d3_AccountReviewController_Webauthn::class,
],
'controllers' => [
'd3user_webauthn' => d3user_webauthn::class,
'd3webauthnlogin' => d3webauthnlogin::class,
'd3webauthnadminlogin' => d3webauthnadminlogin::class,
'd3_account_webauthn' => d3_account_webauthn::class
'd3_account_webauthn' => d3_account_webauthn::class,
],
'templates' => [
'd3user_webauthn.tpl' => 'd3/oxwebauthn/Application/views/admin/tpl/d3user_webauthn.tpl',
@ -139,14 +139,14 @@ $aModule = array(
'template' => 'page/checkout/inc/options.tpl',
'block' => 'checkout_options_login',
'file' => 'Application/views/blocks/page/checkout/inc/checkout_options_login.tpl',
]
],
],
'settings' => [
[
'group' => $sModuleId.'_general',
'name' => $sModuleId.'_diffshopurl',
'type' => 'str',
'value' => false
'value' => false,
],
]
);
],
];

View File

@ -41,7 +41,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 1,
'oxusername' => 'noadmin@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
],
true
);
@ -54,7 +54,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 1,
'oxusername' => 'admin@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
],
true
);
@ -67,7 +67,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 2,
'oxusername' => 'wrongshop@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
],
true
);
@ -80,7 +80,7 @@ class passwordAdminAuthTest extends integrationTestCase
'oxshopid' => 1,
'oxusername' => 'inactive@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
],
true
);

View File

@ -36,7 +36,7 @@ class passwordFrontendAuthTest extends integrationTestCase
'oxshopid' => 1,
'oxusername' => 'noadmin@user.localhost',
'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
]
);
@ -48,7 +48,7 @@ class passwordFrontendAuthTest extends integrationTestCase
'oxshopid' => 2,
'oxusername' => 'wrongshop_fe@user.localhost',
'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
]
);
@ -60,7 +60,7 @@ class passwordFrontendAuthTest extends integrationTestCase
'oxshopid' => 1,
'oxusername' => 'inactive@user.localhost',
'oxpassword' => '$2y$10$b3O5amXZVMGGZbL4X10TIOHiOwEkq3C0ofObuTgHAS4Io0uMLauUS', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
]
);
}

View File

@ -32,7 +32,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
2 => 'credId2',
3 => 'credId3',
4 => 'credId4',
5 => 'credId5'
5 => 'credId5',
];
public function createTestData()
@ -47,7 +47,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1,
'oxusername' => 'wawrongshopid@user.localhost',
'oxpassword' => '$2y$10$QErMJNHQCoN03tfCUQDRfOvbwvqfzwWw1iI/7bC49fKQrPKoDdnaK', // 123456
'oxstreet' => __CLASS__
'oxstreet' => __CLASS__,
],
true
);
@ -60,7 +60,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1,
'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOj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jXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
]
);
@ -72,7 +72,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1,
'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOjE6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30='
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOjE6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
]
);
@ -84,7 +84,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1,
'name' => __CLASS__,
'credential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ZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOjE6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
]
);
@ -96,7 +96,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 1,
'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo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dGlvblR5cGUiO3M6NDoibm9uZSI7czoxMjoiACoAdHJ1c3RQYXRoIjtPOjMzOiJXZWJhdXRoblxUcnVzdFBhdGhcRW1wdHlUcnVzdFBhdGgiOjA6e31zOjk6IgAqAGFhZ3VpZCI7TzozNToiUmFtc2V5XFV1aWRcTGF6eVxMYXp5VXVpZEZyb21TdHJpbmciOjE6e3M6Njoic3RyaW5nIjtzOjM2OiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
]
);
@ -108,7 +108,7 @@ class webauthnAdminAuthTest extends passwordAdminAuthTest
'oxshopid' => 2,
'name' => __CLASS__,
'credentialid' => 'ITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAAA==',
'credential'=> 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo3MDoiITSNkDRdN1bfRrb9MDCNOfBNay7YqT3ZxWxxqIQWVvwN0tFOG7SN2JiCfcUfPMBhE9bTLU1Gbb/8+5eHyFR2d5DCrxAAACI7czo3OiIAKgB0eXBlIjtzOjEwOiJwdWJsaWMta2V5IjtzOjEzOiIAKgB0cmFuc3BvcnRzIjthOjA6e31zOjE4OiIAKgBhdHRlc3RhdGlvblR5cGUiO3M6NDo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wMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDAiO31zOjIyOiIAKgBjcmVkZW50aWFsUHVibGljS2V5IjtzOjc3OiKlAQIDJiABIVggHucXfQh0acwpsffVRM02F7P57mVm6hPX/l8Pjbh0jOwiWCBRT5MMqa909tcXHqG/EKfjXXDd9UEisk+ZF7QSTfwv0CI7czoxMzoiACoAdXNlckhhbmRsZSI7czoxNDoib3hkZWZhdWx0YWRtaW4iO3M6MTA6IgAqAGNvdW50ZXIiO2k6NDI3MTtzOjEwOiIAKgBvdGhlclVJIjtOO30=',
]
);
}

View File

@ -71,7 +71,7 @@ class d3user_webauthnTest extends TestCase
->onlyMethods([
'd3CallMockableFunction',
'getEditObjectId',
'd3GetMockableOxNewObject'
'd3GetMockableOxNewObject',
])
->getMock();
$sutMock->method('d3CallMockableFunction')->willReturn(true);
@ -145,7 +145,7 @@ class d3user_webauthnTest extends TestCase
'setPageType',
'setAuthnRegister',
'd3GetMockableLogger',
'd3GetMockableRegistryObject'
'd3GetMockableRegistryObject',
])
->getMock();
$sutMock->expects($this->atLeastOnce())->method('setPageType');
@ -194,7 +194,7 @@ class d3user_webauthnTest extends TestCase
'setPageType',
'setAuthnRegister',
'd3GetMockableLogger',
'd3GetMockableRegistryObject'
'd3GetMockableRegistryObject',
])
->getMock();
$sutMock->expects($this->atLeastOnce())->method('setPageType');
@ -566,7 +566,7 @@ class d3user_webauthnTest extends TestCase
public function canDeleteDataProvider(): array
{
return [
'has delete id' => ['deleteId', $this->once()]
'has delete id' => ['deleteId', $this->once()],
];
}
}

View File

@ -61,7 +61,8 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
* @return void
*/
public function canGetNavigationParams()
{}
{
}
/**
* @test
@ -78,7 +79,7 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
->getMock();
$sessionMock->method('hasVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_AUTH, $auth],
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $userFromLogin]
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $userFromLogin],
]);
/** @var Utils|MockObject $utilsMock */
@ -97,7 +98,7 @@ class d3webauthnadminloginTest extends d3webauthnloginTest
/** @var d3webauthnlogin|MockObject $sut */
$sut = $this->getMockBuilder($this->sutClassName)
->onlyMethods(['d3GetMockableRegistryObject', 'd3CallMockableFunction', 'd3GetMockableOxNewObject',
'generateCredentialRequest', 'addTplParam'])
'generateCredentialRequest', 'addTplParam', ])
->getMock();
$sut->method('d3GetMockableRegistryObject')->willReturnCallback(
function () use ($utilsMock, $sessionMock) {

View File

@ -47,7 +47,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable'])
->getMock();
$sessionMock->method('getVariable')->willReturn([
'key1' => 'variable1'
'key1' => 'variable1',
]);
/** @var d3webauthnlogin|MockObject $sut */
@ -71,7 +71,7 @@ class d3webauthnloginTest extends UnitTestCase
[
'defKey1' => 'devValues1',
'key1' => 'variable1',
'cl' => NULL,
'cl' => null,
],
$this->callMethod(
$sut,
@ -99,7 +99,7 @@ class d3webauthnloginTest extends UnitTestCase
->getMock();
$sessionMock->method('hasVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_SESSION_AUTH, $auth],
[WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $userFromLogin]
[WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $userFromLogin],
]);
/** @var Utils|MockObject $utilsMock */
@ -112,7 +112,7 @@ class d3webauthnloginTest extends UnitTestCase
/** @var d3webauthnlogin|MockObject $sut */
$sut = $this->getMockBuilder($this->sutClassName)
->onlyMethods(['d3GetMockableRegistryObject', 'd3CallMockableFunction',
'generateCredentialRequest', 'addTplParam'])
'generateCredentialRequest', 'addTplParam', ])
->getMock();
$sut->method('d3GetMockableRegistryObject')->willReturnCallback(
function () use ($utilsMock, $sessionMock) {
@ -174,7 +174,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable'])
->getMock();
$sessionMock->method('getVariable')->willReturnMap([
[$userSessionVarName, $currUserFixture]
[$userSessionVarName, $currUserFixture],
]);
/** @var Webauthn|MockObject $webAuthnMock */
@ -240,7 +240,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable', 'setVariable'])
->getMock();
$sessionMock->method('getVariable')->willReturnMap([
[$userVarName, $currUserFixture]
[$userVarName, $currUserFixture],
]);
$sessionMock->expects($this->once())->method('setVariable')->with(WebauthnConf::GLOBAL_SWITCH)
->willReturn(true);
@ -262,7 +262,7 @@ class d3webauthnloginTest extends UnitTestCase
/** @var d3webauthnlogin|MockObject $sut */
$sut = $this->getMockBuilder($this->sutClassName)
->onlyMethods(['d3GetMockableOxNewObject', 'addTplParam',
'd3GetMockableLogger', 'd3GetMockableRegistryObject'])
'd3GetMockableLogger', 'd3GetMockableRegistryObject', ])
->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback(
function () use ($webAuthnMock) {
@ -313,7 +313,7 @@ class d3webauthnloginTest extends UnitTestCase
->onlyMethods(['getVariable'])
->getMock();
$sessionMock->method('getVariable')->willReturnMap([
[$sessionVarName, $currClassFixture]
[$sessionVarName, $currClassFixture],
]);
/** @var d3webauthnlogin|MockObject $sut */
@ -410,7 +410,7 @@ class d3webauthnloginTest extends UnitTestCase
{
return [
[true],
[false]
[false],
];
}

View File

@ -105,7 +105,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
$pkc->setId($oxid);
$pkc->assign([
'credentialid' => base64_encode('myCredentialId'),
'oxshopid' => 55
'oxshopid' => 55,
]);
$pkc->setCredential($pkcsMock);
$pkc->save();
@ -132,7 +132,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
{
return [
'existing' => [true, 'pkcsource'],
'not existing' => [false, null]
'not existing' => [false, null],
];
}
@ -185,7 +185,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
$pkc->setId($oxid);
$pkc->assign([
'oxuserid' => 'userid',
'oxshopid' => 55
'oxshopid' => 55,
]);
$pkc->setCredential($pkcsMock);
$pkc->save();
@ -271,7 +271,7 @@ class PublicKeyCredentialListTest extends UnitTestCase
$pkc->setId($oxid);
$pkc->assign([
'oxuserid' => 'userid',
'oxshopid' => 55
'oxshopid' => 55,
]);
$pkc->setCredential($pkcsMock);
$pkc->save();

View File

@ -86,7 +86,7 @@ class PublicKeyCredentialTest extends UnitTestCase
/** @var PublicKeyCredential $sut */
$sut = oxNew(PublicKeyCredential::class);
$sut->assign([
$fieldName => $setValue
$fieldName => $setValue,
]);
$this->assertEquals(
@ -318,7 +318,7 @@ class PublicKeyCredentialTest extends UnitTestCase
$sut->setId($oxid);
$sut->assign([
'credentialid' => base64_encode($pkcId),
'oxshopid' => $shopId
'oxshopid' => $shopId,
]);
$sut->save();
}
@ -344,7 +344,7 @@ class PublicKeyCredentialTest extends UnitTestCase
{
return [
'item exists' => [true, 'idFixture'],
'item not exists' => [false, null]
'item not exists' => [false, null],
];
}
}

View File

@ -48,7 +48,7 @@ class WebauthnExceptionTest extends UnitTestCase
/** @var WebauthnException|MockObject $sut */
$sut = $this->getMockBuilder(WebauthnException::class)
->onlyMethods(['setDetailedErrorMessage', 'getErrorMessageTranslator', 'getRequestType',
'd3CallMockableFunction'])
'd3CallMockableFunction', ])
->disableOriginalConstructor()
->getMock();
$sut->expects($this->once())->method('setDetailedErrorMessage');
@ -150,7 +150,7 @@ class WebauthnExceptionTest extends UnitTestCase
{
return [
'message is string' => ['errorMessageFixture'],
'message is null' => [null]
'message is null' => [null],
];
}
}

View File

@ -96,7 +96,7 @@ class RelyingPartyEntityTest extends TestCase
'null' => [null, false],
'empty string' => ['', false],
'space string' => [' ', false],
'non empty string' => ['content', true]
'non empty string' => ['content', true],
];
}
@ -222,7 +222,7 @@ class RelyingPartyEntityTest extends TestCase
{
return [
'configured' => [true, ' subd.mydomain.com', 'www.myhost.de', 'subd.mydomain.com'],
'not configured'=> [false, ' subd.mydomain.com', 'www.myhost.de', 'www.myhost.de']
'not configured'=> [false, ' subd.mydomain.com', 'www.myhost.de', 'www.myhost.de'],
];
}

View File

@ -59,7 +59,7 @@ class UserEntityTest extends UnitTestCase
$this->identicalTo([
'usernamefixture',
'userId',
'fNameFixture lNameFixture'
'fNameFixture lNameFixture',
])
);

View File

@ -66,7 +66,7 @@ class WebauthnAfterLoginTest extends UnitTestCase
->getMock();
$sessionMock->method('getVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_ADMIN_PROFILE, $sessionProfile],
['aAdminProfiles', [['prof','No0'], ['prof', 'No1'], ['prof','No2']]]
['aAdminProfiles', [['prof','No0'], ['prof', 'No1'], ['prof','No2']]],
]);
$sessionMock->expects($this->once())->method('deleteVariable');
$sessionMock->expects($this->exactly((int) $setSessionVar))->method('setVariable');
@ -210,7 +210,7 @@ class WebauthnAfterLoginTest extends UnitTestCase
$en_2->selected = 0;
return [
$de_1,
$en_2
$en_2,
];
}

View File

@ -127,7 +127,7 @@ class WebauthnErrorsTest extends UnitTestCase
{
return [
'with colon' => [' My Text With : Colon', 'my text with'],
'without colon' => [' My Text With Colon', 'my text with colon']
'without colon' => [' My Text With Colon', 'my text with colon'],
];
}
}

View File

@ -216,7 +216,7 @@ class WebauthnLoginTest extends UnitTestCase
$sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setFrontendSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setSessionCookie',
'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId'])
'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId', ])
->disableOriginalConstructor()
->getMock();
$sut->expects($this->exactly((int) $setCookie))->method('setSessionCookie');
@ -281,7 +281,7 @@ class WebauthnLoginTest extends UnitTestCase
$sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn', 'd3GetMockableRegistryObject',
'setFrontendSession', 'handleBackendCookie', 'handleBackendSubshopRights', 'setSessionCookie',
'd3GetMockableLogger', 'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId'])
'd3GetMockableLogger', 'd3GetMockableOxNewObject', 'getCredential', 'regenerateSessionId', ])
->disableOriginalConstructor()
->getMock();
$sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass));
@ -350,7 +350,7 @@ class WebauthnLoginTest extends UnitTestCase
$sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights',
'd3GetMockableOxNewObject'])
'd3GetMockableOxNewObject', ])
->disableOriginalConstructor()
->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback(
@ -412,7 +412,7 @@ class WebauthnLoginTest extends UnitTestCase
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights',
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject',
'd3GetMockableLogger'])
'd3GetMockableLogger', ])
->disableOriginalConstructor()
->getMock();
$sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass));
@ -675,7 +675,7 @@ class WebauthnLoginTest extends UnitTestCase
{
return [
'set cookie' => [true],
'dont set cookie' => [false]
'dont set cookie' => [false],
];
}
@ -1065,10 +1065,11 @@ class WebauthnLoginTest extends UnitTestCase
$sessionMock->method('getVariable')->willReturnCallback(
function () {
$args = func_get_args();
if ($args[0] === WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER)
if ($args[0] === WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER) {
return 'adminUser';
elseif ($args[0] === WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER)
} elseif ($args[0] === WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER) {
return 'frontendUser';
}
return null;
}
);
@ -1126,11 +1127,11 @@ class WebauthnLoginTest extends UnitTestCase
$sessionMock->expects($this->exactly(2))->method('setVariable')->withConsecutive(
[
$this->identicalTo(WebauthnConf::WEBAUTHN_SESSION_AUTH),
$this->identicalTo('credentialFixture')
$this->identicalTo('credentialFixture'),
],
[
$this->identicalTo(WebauthnConf::OXID_FRONTEND_AUTH),
$this->identicalTo('idFixture')
$this->identicalTo('idFixture'),
]
);

View File

@ -107,7 +107,7 @@ class WebauthnTest extends UnitTestCase
'REMOTE_ADDR v6' => [null, null, null, '::1', true],
'REMOTE_ADDR localhost' => [null, null, null, 'some.localhost', true],
'unset' => [null, null, null, null, false],
'not valid' => ['off', 'http', 'off', '160.158.23.7', false]
'not valid' => ['off', 'http', 'off', '160.158.23.7', false],
];
}
@ -164,7 +164,7 @@ class WebauthnTest extends UnitTestCase
/** @var Webauthn|MockObject $sut */
$sut = $this->getMockBuilder(Webauthn::class)
->onlyMethods(['d3GetMockableOxNewObject', 'getServer', 'd3GetMockableRegistryObject', 'jsonEncode',
'getExistingCredentials'
'getExistingCredentials',
])
->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback(
@ -192,7 +192,7 @@ class WebauthnTest extends UnitTestCase
);
$sut->expects($this->once())->method('jsonEncode')->willReturn($jsonReturn);
$sut->expects($this->once())->method('getExistingCredentials')->willReturn([
$pubKeyCredDescriptorMock
$pubKeyCredDescriptorMock,
]);
if (!$jsonReturn) {
@ -361,7 +361,7 @@ class WebauthnTest extends UnitTestCase
/** @var Webauthn|MockObject $sut */
$sut = $this->getMockBuilder(Webauthn::class)
->onlyMethods(['d3GetMockableOxNewObject', 'getServer', 'd3GetMockableRegistryObject', 'jsonEncode',
'getExistingCredentials'
'getExistingCredentials',
])
->getMock();
$sut->method('d3GetMockableOxNewObject')->willReturnCallback(
@ -391,7 +391,7 @@ class WebauthnTest extends UnitTestCase
);
$sut->expects($this->once())->method('jsonEncode')->willReturn($jsonReturn);
$sut->expects($this->once())->method('getExistingCredentials')->willReturn([
$pubKeyCredDescriptorMock
$pubKeyCredDescriptorMock,
]);
if (!$jsonReturn) {
@ -695,7 +695,7 @@ class WebauthnTest extends UnitTestCase
$sessionMock->method('getVariable')->willReturnMap(
[
[WebauthnConf::WEBAUTHN_ADMIN_SESSION_CURRENTUSER, $adminUser],
[WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $frontendUser]
[WebauthnConf::WEBAUTHN_SESSION_CURRENTUSER, $frontendUser],
]
);
@ -732,7 +732,7 @@ class WebauthnTest extends UnitTestCase
{
return [
'admin' => [true, 'admUsr', 'frontendUsr', 'admUsr'],
'frontend' => [false, 'admUsr', 'frontendUsr', 'frontendUsr']
'frontend' => [false, 'admUsr', 'frontendUsr', 'frontendUsr'],
];
}
@ -819,7 +819,7 @@ class WebauthnTest extends UnitTestCase
'user use webauthn, config disabled' => [true, false, true, false],
'user use webauthn, session disabled' => [false, true, true, false],
'user use webauthn, both disabled' => [true, true, true, false],
'user dont use ' => [false, false, false, false]
'user dont use ' => [false, false, false, false],
];
}

View File

@ -92,7 +92,7 @@ class UserComponentWebauthnTest extends UnitTestCase
->onlyMethods(['getRequestParameter'])
->getMock();
$requestMock->method('getRequestParameter')->willReturnMap([
['lgn_usr', 'myUserName']
['lgn_usr', 'myUserName'],
]);
/** @var User|MockObject $userMock */
@ -112,7 +112,7 @@ class UserComponentWebauthnTest extends UnitTestCase
/** @var d3_webauthn_UserComponent|MockObject $sut */
$sut = $this->getMockBuilder(UserComponent::class)
->onlyMethods(['d3CanUseWebauthn', 'd3CallMockableFunction', 'd3HasWebauthnButNotLoggedin',
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject', 'getParent'
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject', 'getParent',
])
->getMock();
$sut->method('d3CanUseWebauthn')->willReturn($canUseWebauthn);
@ -433,7 +433,7 @@ class UserComponentWebauthnTest extends UnitTestCase
return [
'passed' => [null, $this->once(), $this->never()],
'webauthnException' => [WebauthnGetException::class, $this->never(), $this->once()],
'webauthnLoginError' => [WebauthnLoginErrorException::class, $this->never(), $this->never()]
'webauthnLoginError' => [WebauthnLoginErrorException::class, $this->never(), $this->never()],
];
}
}

View File

@ -228,7 +228,7 @@ class LoginControllerWebauthnTest extends UnitTestCase
->getMock();
$requestMock->method('getRequestParameter')->willReturnMap([
['user', 'myUserName'],
['profile', 'myProfile']
['profile', 'myProfile'],
]);
/** @var User|MockObject $userMock */
@ -248,7 +248,7 @@ class LoginControllerWebauthnTest extends UnitTestCase
/** @var LoginController|MockObject $sut */
$sut = $this->getMockBuilder(LoginController::class)
->onlyMethods(['d3CanUseWebauthn', 'd3CallMockableFunction', 'hasWebauthnButNotLoggedin',
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject'
'd3GetMockableOxNewObject', 'd3GetMockableRegistryObject',
])
->getMock();
$sut->method('d3CanUseWebauthn')->willReturn($canUseWebauthn);

View File

@ -117,7 +117,7 @@ trait CheckoutTestTrait
$sut->setUser(oxNew(User::class));
if ($expected === 'parent') {
$this->assertSame( $return, $hasUser ? $this->userFixture : false);
$this->assertSame($return, $hasUser ? $this->userFixture : false);
} else {
$this->assertSame($return, $expected);
}

View File

@ -58,7 +58,8 @@ class UserWebauthnTest extends UnitTestCase
/** @var d3_User_Webauthn $user */
$user = oxNew(User::class);
$user->delete($this->userId);
} catch (Exception $e) {}
} catch (Exception $e) {
}
}
/**
@ -163,7 +164,7 @@ class UserWebauthnTest extends UnitTestCase
->getMock();
$sessionMock->method('getVariable')->willReturnMap([
[WebauthnConf::WEBAUTHN_SESSION_AUTH, $authInSession],
[WebauthnConf::WEBAUTHN_SESSION_LOGINUSER, $userNameInSession]
[WebauthnConf::WEBAUTHN_SESSION_LOGINUSER, $userNameInSession],
]);
/** @var User|MockObject $sut */

View File

@ -569,7 +569,7 @@ class ActionsTest extends UnitTestCase
{
return [
'has SEO url' => ['https://testshop.dev/securitykeys', true],
'has no SEO url'=> ['', false]
'has no SEO url'=> ['', false],
];
}