improve code

This commit is contained in:
Daniel Seifert 2023-01-28 23:41:39 +01:00 committed by Daniel Seifert
parent cf5c492124
commit 359379c1a0
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
31 changed files with 58 additions and 63 deletions

View File

@ -10,4 +10,4 @@ parameters:
- '#Call to an undefined method OxidEsales\\Eshop\\Core\\Controller\\BaseController::getNavigationParams\(\)\.#'
- '#Call to an undefined method PHPUnit\\Framework\\MockObject\\MockObject::.*#'
- '#Return type \(array\) of method D3\\Webauthn\\Application\\Controller\\d3webauthnlogin::getBreadCrumb\(\) should be compatible with return type \(null\) of method OxidEsales\\EshopCommunity\\Application\\Controller\\FrontendController::getBreadCrumb\(\)#'
- '#Method D3\\Webauthn\\Application\\Model\\RelyingPartyEntity::getActiveShop\(\) should return OxidEsales\\Eshop\\Application\\Model\\Shop but returns oxShop.#'
- '#PHPDoc tag @throws with type OxidEsales\\EshopCommunity\\Internal\\Framework\\Module\\Configuration\\Exception\\ModuleConfigurationNotFoundException|Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'

View File

@ -169,7 +169,8 @@ class d3webauthnadminlogin extends AdminController
/** @var Request $request */
$request = d3GetOxidDIC()->get('d3ox.webauthn.'.Request::class);
return oxNew(WebauthnLogin::class,
return oxNew(
WebauthnLogin::class,
$request->getRequestEscapedParameter('credential'),
$request->getRequestEscapedParameter('error')
);

View File

@ -23,6 +23,7 @@ use DateTime;
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
use Doctrine\DBAL\Exception as DoctrineException;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Statement;
use Exception;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Model\BaseModel;
@ -205,7 +206,9 @@ class PublicKeyCredential extends BaseModel
)
)
);
$oxid = $qb->execute()->fetchOne();
/** @var Statement $stmt */
$stmt = $qb->execute();
$oxid = $stmt->fetchOne();
return strlen((string) $oxid) ? $oxid : null;
}

View File

@ -20,6 +20,7 @@ use D3\TestingTools\Production\IsMockable;
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
use Doctrine\DBAL\Exception as DoctrineException;
use Doctrine\DBAL\Query\QueryBuilder;
use Doctrine\DBAL\Statement;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Model\ListModel;
@ -68,10 +69,10 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
)
)
);
$credential = $qb->execute()->fetchOne();
//dumpvar($qb->getSQL());
//dumpvar($qb->getParameters());
//dumpvar(unserialize(base64_decode($credential)));
/** @var Statement $stmt */
$stmt = $qb->execute();
$credential = $stmt->fetchOne();
if (!strlen((string) $credential)) {
return null;
}
@ -108,13 +109,16 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
)
);
/** @var Statement $stmt */
$stmt = $qb->execute();
// generate decoded credentials list
return array_map(function (array $fields) {
/** @var PublicKeyCredential $credential */
$credential = clone $this->getBaseObject();
$credential->assign(['credential' => $fields['credential']]);
return $credential->getCredential();
}, $qb->execute()->fetchAllAssociative());
}, $stmt->fetchAllAssociative());
}
/**
@ -148,7 +152,9 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
)
);
foreach ($qb->execute()->fetchAllAssociative() as $fields) {
/** @var Statement $stmt */
$stmt = $qb->execute();
foreach ($stmt->fetchAllAssociative() as $fields) {
$id = $fields['oxid'];
$credential = clone $this->getBaseObject();
$credential->load($id);
@ -163,6 +169,8 @@ class PublicKeyCredentialList extends ListModel implements PublicKeyCredentialSo
* @param PublicKeyCredentialSource $publicKeyCredentialSource
* @return void
* @throws AssertionFailedException
* @throws DoctrineDriverException
* @throws DoctrineException
*/
public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource): void
{

View File

@ -80,6 +80,7 @@ class Webauthn
public function getCreationOptions(User $user): string
{
d3GetOxidDIC()->set(UserEntity::class.'.args.user', $user);
/** @var UserEntity $userEntity */
$userEntity = d3GetOxidDIC()->get(UserEntity::class);
$publicKeyCredentialCreationOptions = $this->getServer()->generatePublicKeyCredentialCreationOptions(
@ -140,6 +141,7 @@ class Webauthn
$user = d3GetOxidDIC()->get('d3ox.webauthn.'.User::class);
$user->load($userId);
d3GetOxidDIC()->set(UserEntity::class.'.args.user', $user);
/** @var UserEntity $userEntity */
$userEntity = d3GetOxidDIC()->get(UserEntity::class);
// We generate the set of options.
@ -166,7 +168,9 @@ class Webauthn
protected function getServer(): Server
{
$server = $this->getServerObject();
$server->setLogger(d3GetOxidDIC()->get('d3ox.webauthn.'.LoggerInterface::class));
/** @var LoggerInterface $logger */
$logger = d3GetOxidDIC()->get('d3ox.webauthn.'.LoggerInterface::class);
$server->setLogger($logger);
return $server;
}
@ -248,7 +252,10 @@ class Webauthn
$user->load($userId);
d3GetOxidDIC()->set(UserEntity::class.'.args.user', $user);
return d3GetOxidDIC()->get(UserEntity::class);
/** @var UserEntity $userEntity */
$userEntity = d3GetOxidDIC()->get(UserEntity::class);
return $userEntity;
}
/**

View File

@ -32,7 +32,7 @@ class WebauthnErrors
public const UNSECURECONNECTION = 'D3_WEBAUTHN_ERR_UNSECURECONNECTION';
/**
* @param $msg
* @param string $msg
* @param null|string $type
* @return string
*/

View File

@ -117,7 +117,9 @@ class WebauthnLogin
$this->assertAuthn();
// relogin, don't extract from this try block
$usrCmp->setUser(d3GetOxidDIC()->get('d3ox.webauthn.'.User::class));
/** @var User $user */
$user = d3GetOxidDIC()->get('d3ox.webauthn.'.User::class);
$usrCmp->setUser($user);
$this->setFrontendSession($user);
$usrCmp->setLoginStatus(USER_LOGIN_SUCCESS);
@ -226,6 +228,7 @@ class WebauthnLogin
*/
public function setAdminSession($userId): Session
{
/** @var Session $session */
$session = d3GetOxidDIC()->get('d3ox.webauthn.'.Session::class);
$adminProfiles = $session->getVariable("aAdminProfiles");
$session->initNewSession();
@ -257,6 +260,7 @@ class WebauthnLogin
*/
public function assertUser($userId, bool $isBackend = false): User
{
/** @var User $user */
$user = d3GetOxidDIC()->get('d3ox.webauthn.'.User::class);
$user->load($userId);
if (!$user->isLoaded() ||

View File

@ -167,7 +167,8 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
/** @var Request $request */
$request = d3GetOxidDIC()->get('d3ox.webauthn.'.Request::class);
return oxNew(WebauthnLogin::class,
return oxNew(
WebauthnLogin::class,
$request->getRequestEscapedParameter('credential'),
$request->getRequestEscapedParameter('error')
);

View File

@ -18,9 +18,11 @@ namespace D3\Webauthn\Modules\Application\Model;
use D3\TestingTools\Production\IsMockable;
use D3\Webauthn\Application\Model\WebauthnConf;
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
use Doctrine\DBAL\Driver\Mysqli\MysqliStatement;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Query\QueryBuilder;
use OxidEsales\Eshop\Application\Model\User;
use Doctrine\DBAL\Statement;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
@ -144,6 +146,8 @@ class d3_User_Webauthn extends d3_User_Webauthn_parent
)
)->setMaxResults(1);
return $qb->execute()->fetchOne() ?: null;
/** @var Statement $stmt */
$stmt = $qb->execute();
return $stmt->fetchOne() ?: null;
}
}

View File

@ -21,7 +21,6 @@ use Exception;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\DbMetaDataHandler;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -39,11 +38,10 @@ use Psr\Log\LoggerInterface;
class Actions
{
use IsMockable;
public const FIELDLENGTH_CREDID = 512;
public const FIELDLENGTH_CREDENTIAL = 2000;
use IsMockable;
public $seo_de = 'sicherheitsschluessel';
public $seo_en = 'en/key-authentication';
public $stdClassName = 'd3_account_webauthn';

View File

@ -14,7 +14,6 @@
namespace D3\Webauthn\tests;
use D3\ModCfg\Tests\additional_abstract;
use OxidEsales\Eshop\Core\Exception\StandardException;
class additional extends additional_abstract
{

View File

@ -18,7 +18,6 @@ namespace D3\Webauthn\tests\integration;
use D3\Webauthn\Application\Model\WebauthnConf;
use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
use OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Registry;
class passwordAdminAuthTest extends integrationTestCase

View File

@ -28,7 +28,6 @@ use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Utils;
use OxidEsales\Eshop\Core\UtilsView;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use ReflectionException;
@ -73,7 +72,7 @@ class d3user_webauthnTest extends WAUnitTestCase
$sutMock = $this->getMockBuilder(d3user_webauthn::class)
->onlyMethods([
'd3CallMockableFunction',
'getEditObjectId'
'getEditObjectId',
])
->getMock();
$sutMock->method('d3CallMockableFunction')->willReturn(true);
@ -132,7 +131,7 @@ class d3user_webauthnTest extends WAUnitTestCase
$sutMock = $this->getMockBuilder(d3user_webauthn::class)
->onlyMethods([
'setPageType',
'setAuthnRegister'
'setAuthnRegister',
])
->getMock();
$sutMock->expects($this->atLeastOnce())->method('setPageType');
@ -169,7 +168,7 @@ class d3user_webauthnTest extends WAUnitTestCase
$sutMock = $this->getMockBuilder(d3user_webauthn::class)
->onlyMethods([
'setPageType',
'setAuthnRegister'
'setAuthnRegister',
])
->getMock();
$sutMock->expects($this->atLeastOnce())->method('setPageType');

View File

@ -25,7 +25,6 @@ use D3\Webauthn\Application\Model\WebauthnConf;
use D3\Webauthn\Application\Model\WebauthnLogin;
use D3\Webauthn\tests\unit\Application\Controller\d3webauthnloginTest;
use Generator;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\Eshop\Core\Utils;

View File

@ -25,10 +25,8 @@ use D3\Webauthn\Application\Model\Webauthn;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use Generator;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use OxidEsales\Eshop\Core\UtilsView;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use ReflectionException;

View File

@ -22,10 +22,8 @@ use D3\Webauthn\Application\Model\Webauthn;
use D3\Webauthn\Application\Model\WebauthnConf;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use Generator;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\Eshop\Core\Utils;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use ReflectionException;

View File

@ -20,11 +20,8 @@ use D3\Webauthn\Application\Model\Credential\PublicKeyCredential;
use D3\Webauthn\Application\Model\Credential\PublicKeyCredentialList;
use D3\Webauthn\Application\Model\UserEntity;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use Hoa\Iterator\Mock;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;
use Webauthn\PublicKeyCredentialSource;
@ -95,7 +92,7 @@ class PublicKeyCredentialListTest extends WAUnitTestCase
'oxshopid' => 55,
'name' => __METHOD__,
// can't get mock of PublicKeyCredentialSource because of cascaded mock object is not serializable
'credential' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tle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MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/b094o/XiJmXWUkVr8cvhAucLplHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9',
]);
$pkc->save();
}
@ -174,7 +171,7 @@ class PublicKeyCredentialListTest extends WAUnitTestCase
'oxshopid' => 55,
'credentialid' => __METHOD__,
// can't get mock of PublicKeyCredentialSource because of cascaded mock object is not serializable
'credential' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo2NToiAQUtRW3vxImpllhVhp3sUeC0aBae8rFm0hBhHpVSdkdrmqZp+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJh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zGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9',
]);
$pkc->save();
}
@ -195,9 +192,9 @@ class PublicKeyCredentialListTest extends WAUnitTestCase
);
if ($expected === 'pkcsource') {
$this->assertCount( 2, $list );
foreach ( $list as $item ) {
$this->assertInstanceOf( PublicKeyCredentialSource::class, $item );
$this->assertCount(2, $list);
foreach ($list as $item) {
$this->assertInstanceOf(PublicKeyCredentialSource::class, $item);
}
} else {
$this->assertEmpty($list);
@ -205,7 +202,7 @@ class PublicKeyCredentialListTest extends WAUnitTestCase
} finally {
if ($doCreate) {
foreach ($oxids as $oxid) {
/** @var PublicKeyCredential $pkc */
/** @var PublicKeyCredential|MockObject $pkc */
$pkc = $this->getMockBuilder(PublicKeyCredential::class)
->onlyMethods(['allowDerivedDelete'])
->getMock();
@ -262,7 +259,7 @@ class PublicKeyCredentialListTest extends WAUnitTestCase
'oxshopid' => 55,
'credentialid' => __METHOD__,
// can't get mock of PublicKeyCredentialSource because of cascaded mock object is not serializable
'credential' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo2NToiAQUtRW3vxImpllhVhp3sUeC0aBae8rFm0hBhHpVSdkdrmqZp+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo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plHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9',
]);
$pkc->save();
}

View File

@ -20,8 +20,6 @@ use D3\Webauthn\Application\Model\Credential\PublicKeyCredential;
use D3\Webauthn\Application\Model\Credential\PublicKeyCredentialList;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;
use Webauthn\PublicKeyCredentialSource;

View File

@ -18,7 +18,6 @@ namespace D3\Webauthn\tests\unit\Application\Model\Exceptions;
use D3\TestingTools\Development\CanAccessRestricted;
use D3\Webauthn\Application\Model\Exceptions\WebauthnCreateException;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -20,7 +20,6 @@ use D3\Webauthn\Application\Model\Exceptions\WebauthnException;
use D3\Webauthn\Application\Model\WebauthnErrors;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use Exception;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -18,7 +18,6 @@ namespace D3\Webauthn\tests\unit\Application\Model\Exceptions;
use D3\TestingTools\Development\CanAccessRestricted;
use D3\Webauthn\Application\Model\Exceptions\WebauthnGetException;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -20,7 +20,6 @@ use D3\Webauthn\Application\Model\RelyingPartyEntity;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Application\Model\Shop;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use ReflectionException;
class RelyingPartyEntityTest extends WAUnitTestCase

View File

@ -20,7 +20,6 @@ use D3\Webauthn\Application\Model\Exceptions\WebauthnException;
use D3\Webauthn\Application\Model\UserEntity;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -20,11 +20,9 @@ use D3\Webauthn\Application\Model\WebauthnAfterLogin;
use D3\Webauthn\Application\Model\WebauthnConf;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Core\Language;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\Eshop\Core\UtilsServer;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;
use stdClass;

View File

@ -19,8 +19,6 @@ use D3\TestingTools\Development\CanAccessRestricted;
use D3\Webauthn\Application\Model\WebauthnErrors;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Core\Language;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -35,7 +35,6 @@ use OxidEsales\Eshop\Core\SystemEventHandler;
use OxidEsales\Eshop\Core\Utils;
use OxidEsales\Eshop\Core\UtilsServer;
use OxidEsales\Eshop\Core\UtilsView;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use ReflectionException;
@ -325,7 +324,7 @@ class WebauthnLoginTest extends WAUnitTestCase
/** @var WebauthnLogin|MockObject $sut */
$sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights'])
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights', ])
->disableOriginalConstructor()
->getMock();
@ -378,7 +377,7 @@ class WebauthnLoginTest extends WAUnitTestCase
/** @var WebauthnLogin|MockObject $sut */
$sut = $this->getMockBuilder(WebauthnLogin::class)
->onlyMethods(['getUserId', 'handleErrorMessage', 'assertUser', 'assertAuthn',
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights'])
'setAdminSession', 'handleBackendCookie', 'handleBackendSubshopRights', ])
->disableOriginalConstructor()
->getMock();
$sut->method('handleErrorMessage')->willThrowException(oxNew($exceptionClass));

View File

@ -29,10 +29,8 @@ use Exception;
use Generator;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\Eshop\Core\UtilsView;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;
use stdClass;

View File

@ -16,6 +16,7 @@ declare(strict_types=1);
namespace D3\Webauthn\tests\unit\Modules\Application\Component;
use D3\TestingTools\Development\CanAccessRestricted;
use D3\Webauthn\Application\Controller\Admin\d3webauthnadminlogin;
use D3\Webauthn\Application\Model\Exceptions\WebauthnGetException;
use D3\Webauthn\Application\Model\Exceptions\WebauthnLoginErrorException;
use D3\Webauthn\Application\Model\Webauthn;
@ -27,12 +28,10 @@ use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Application\Component\UserComponent;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Controller\BaseController;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\Eshop\Core\Utils;
use OxidEsales\Eshop\Core\UtilsView;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -21,10 +21,8 @@ use D3\Webauthn\Application\Model\WebauthnConf;
use D3\Webauthn\tests\unit\WAUnitTestCase;
use OxidEsales\Eshop\Application\Controller\Admin\LoginController;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Request;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -22,7 +22,6 @@ use OxidEsales\Eshop\Application\Controller\OrderController;
use OxidEsales\Eshop\Application\Controller\PaymentController;
use OxidEsales\Eshop\Application\Controller\UserController;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Session;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;

View File

@ -24,9 +24,7 @@ use Exception;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Exception\UserException;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Session;
use OxidEsales\TestingLibrary\UnitTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use ReflectionException;