diff --git a/phpstan.neon b/phpstan.neon index 431a7e9..d220905 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -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.#' \ No newline at end of file + - '#PHPDoc tag @throws with type OxidEsales\\EshopCommunity\\Internal\\Framework\\Module\\Configuration\\Exception\\ModuleConfigurationNotFoundException|Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#' \ No newline at end of file diff --git a/src/Application/Controller/Admin/d3webauthnadminlogin.php b/src/Application/Controller/Admin/d3webauthnadminlogin.php index f9e2364..83a1650 100755 --- a/src/Application/Controller/Admin/d3webauthnadminlogin.php +++ b/src/Application/Controller/Admin/d3webauthnadminlogin.php @@ -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') ); diff --git a/src/Application/Model/Credential/PublicKeyCredential.php b/src/Application/Model/Credential/PublicKeyCredential.php index a3812d6..377e34f 100755 --- a/src/Application/Model/Credential/PublicKeyCredential.php +++ b/src/Application/Model/Credential/PublicKeyCredential.php @@ -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; } diff --git a/src/Application/Model/Credential/PublicKeyCredentialList.php b/src/Application/Model/Credential/PublicKeyCredentialList.php index 9d8d509..783daca 100755 --- a/src/Application/Model/Credential/PublicKeyCredentialList.php +++ b/src/Application/Model/Credential/PublicKeyCredentialList.php @@ -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 { diff --git a/src/Application/Model/Webauthn.php b/src/Application/Model/Webauthn.php index 5777a37..22abc64 100644 --- a/src/Application/Model/Webauthn.php +++ b/src/Application/Model/Webauthn.php @@ -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; } /** diff --git a/src/Application/Model/WebauthnErrors.php b/src/Application/Model/WebauthnErrors.php index a76072e..cd616f1 100644 --- a/src/Application/Model/WebauthnErrors.php +++ b/src/Application/Model/WebauthnErrors.php @@ -32,7 +32,7 @@ class WebauthnErrors public const UNSECURECONNECTION = 'D3_WEBAUTHN_ERR_UNSECURECONNECTION'; /** - * @param $msg + * @param string $msg * @param null|string $type * @return string */ diff --git a/src/Application/Model/WebauthnLogin.php b/src/Application/Model/WebauthnLogin.php index 7c90861..909374a 100644 --- a/src/Application/Model/WebauthnLogin.php +++ b/src/Application/Model/WebauthnLogin.php @@ -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() || diff --git a/src/Modules/Application/Component/d3_webauthn_UserComponent.php b/src/Modules/Application/Component/d3_webauthn_UserComponent.php index 801e74c..843977a 100755 --- a/src/Modules/Application/Component/d3_webauthn_UserComponent.php +++ b/src/Modules/Application/Component/d3_webauthn_UserComponent.php @@ -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') ); diff --git a/src/Modules/Application/Model/d3_User_Webauthn.php b/src/Modules/Application/Model/d3_User_Webauthn.php index e9dd156..75025f2 100755 --- a/src/Modules/Application/Model/d3_User_Webauthn.php +++ b/src/Modules/Application/Model/d3_User_Webauthn.php @@ -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; } } diff --git a/src/Setup/Actions.php b/src/Setup/Actions.php index fd6efd7..38fd248 100644 --- a/src/Setup/Actions.php +++ b/src/Setup/Actions.php @@ -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'; diff --git a/src/tests/additional.inc.php b/src/tests/additional.inc.php index b51d7b3..4a95ec5 100644 --- a/src/tests/additional.inc.php +++ b/src/tests/additional.inc.php @@ -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 { diff --git a/src/tests/integration/passwordAdminAuthTest.php b/src/tests/integration/passwordAdminAuthTest.php index 3a6998d..c825222 100644 --- a/src/tests/integration/passwordAdminAuthTest.php +++ b/src/tests/integration/passwordAdminAuthTest.php @@ -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 diff --git a/src/tests/unit/Application/Controller/Admin/d3user_webauthnTest.php b/src/tests/unit/Application/Controller/Admin/d3user_webauthnTest.php index 55a5c19..e61bcf5 100644 --- a/src/tests/unit/Application/Controller/Admin/d3user_webauthnTest.php +++ b/src/tests/unit/Application/Controller/Admin/d3user_webauthnTest.php @@ -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'); diff --git a/src/tests/unit/Application/Controller/Admin/d3webauthnadminloginTest.php b/src/tests/unit/Application/Controller/Admin/d3webauthnadminloginTest.php index 02b0ecc..052c15c 100644 --- a/src/tests/unit/Application/Controller/Admin/d3webauthnadminloginTest.php +++ b/src/tests/unit/Application/Controller/Admin/d3webauthnadminloginTest.php @@ -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; diff --git a/src/tests/unit/Application/Controller/d3_account_webauthnTest.php b/src/tests/unit/Application/Controller/d3_account_webauthnTest.php index 3720be8..8adbd21 100644 --- a/src/tests/unit/Application/Controller/d3_account_webauthnTest.php +++ b/src/tests/unit/Application/Controller/d3_account_webauthnTest.php @@ -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; diff --git a/src/tests/unit/Application/Controller/d3webauthnloginTest.php b/src/tests/unit/Application/Controller/d3webauthnloginTest.php index 5924a0c..018f1fc 100644 --- a/src/tests/unit/Application/Controller/d3webauthnloginTest.php +++ b/src/tests/unit/Application/Controller/d3webauthnloginTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/Credential/PublicKeyCredentialListTest.php b/src/tests/unit/Application/Model/Credential/PublicKeyCredentialListTest.php index 4094452..721d969 100644 --- a/src/tests/unit/Application/Model/Credential/PublicKeyCredentialListTest.php +++ b/src/tests/unit/Application/Model/Credential/PublicKeyCredentialListTest.php @@ -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' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo2NToiAQUtRW3vxImpllhVhp3sUeC0aBae8rFm0hBhHpVSdkdrmqZp+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/b094o/XiJmXWUkVr8cvhAucLplHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9' + 'credential' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo2NToiAQUtRW3vxImpllhVhp3sUeC0aBae8rFm0hBhHpVSdkdrmqZp+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/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+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/b094o/XiJmXWUkVr8cvhAucLplHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9' + 'credential' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo2NToiAQUtRW3vxImpllhVhp3sUeC0aBae8rFm0hBhHpVSdkdrmqZp+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/b094o/XiJmXWUkVr8cvhAucLplHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9', ]); $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+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/b094o/XiJmXWUkVr8cvhAucLplHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9' + 'credential' => 'TzozNDoiV2ViYXV0aG5cUHVibGljS2V5Q3JlZGVudGlhbFNvdXJjZSI6MTA6e3M6MjQ6IgAqAHB1YmxpY0tleUNyZWRlbnRpYWxJZCI7czo2NToiAQUtRW3vxImpllhVhp3sUeC0aBae8rFm0hBhHpVSdkdrmqZp+tnfgcuP8xJUbsjMMDyt908zZ2RXAtibmbbilOciO3M6NzoiACoAdHlwZSI7czoxMDoicHVibGljLWtleSI7czoxMzoiACoAdHJhbnNwb3J0cyI7YTowOnt9czoxODoiACoAYXR0ZXN0YXRpb25UeXBlIjtzOjQ6Im5vbmUiO3M6MTI6IgAqAHRydXN0UGF0aCI7TzozMzoiV2ViYXV0aG5cVHJ1c3RQYXRoXEVtcHR5VHJ1c3RQYXRoIjowOnt9czo5OiIAKgBhYWd1aWQiO086MzU6IlJhbXNleVxVdWlkXExhenlcTGF6eVV1aWRGcm9tU3RyaW5nIjoxOntzOjY6InN0cmluZyI7czozNjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIjt9czoyMjoiACoAY3JlZGVudGlhbFB1YmxpY0tleSI7czo3NzoipQECAyYgASFYIKelzI2/b094o/XiJmXWUkVr8cvhAucLplHTxtl0oKtrIlgguKi+0epmmjeemuzzGspNotA7uKnkk4oAmDUOKsJgLykiO3M6MTM6IgAqAHVzZXJIYW5kbGUiO3M6MTQ6Im94ZGVmYXVsdGFkbWluIjtzOjEwOiIAKgBjb3VudGVyIjtpOjA7czoxMDoiACoAb3RoZXJVSSI7Tjt9', ]); $pkc->save(); } diff --git a/src/tests/unit/Application/Model/Credential/PublicKeyCredentialTest.php b/src/tests/unit/Application/Model/Credential/PublicKeyCredentialTest.php index e7fdde4..b0fd0e0 100644 --- a/src/tests/unit/Application/Model/Credential/PublicKeyCredentialTest.php +++ b/src/tests/unit/Application/Model/Credential/PublicKeyCredentialTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/Exceptions/WebauthnCreateExceptionTest.php b/src/tests/unit/Application/Model/Exceptions/WebauthnCreateExceptionTest.php index 53359ce..3ef1b10 100644 --- a/src/tests/unit/Application/Model/Exceptions/WebauthnCreateExceptionTest.php +++ b/src/tests/unit/Application/Model/Exceptions/WebauthnCreateExceptionTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/Exceptions/WebauthnExceptionTest.php b/src/tests/unit/Application/Model/Exceptions/WebauthnExceptionTest.php index 228065c..ad2bf75 100644 --- a/src/tests/unit/Application/Model/Exceptions/WebauthnExceptionTest.php +++ b/src/tests/unit/Application/Model/Exceptions/WebauthnExceptionTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/Exceptions/WebauthnGetExceptionTest.php b/src/tests/unit/Application/Model/Exceptions/WebauthnGetExceptionTest.php index 3d7c6d3..3575ddf 100644 --- a/src/tests/unit/Application/Model/Exceptions/WebauthnGetExceptionTest.php +++ b/src/tests/unit/Application/Model/Exceptions/WebauthnGetExceptionTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/RelyingPartyEntityTest.php b/src/tests/unit/Application/Model/RelyingPartyEntityTest.php index 12d1756..128ca00 100644 --- a/src/tests/unit/Application/Model/RelyingPartyEntityTest.php +++ b/src/tests/unit/Application/Model/RelyingPartyEntityTest.php @@ -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 diff --git a/src/tests/unit/Application/Model/UserEntityTest.php b/src/tests/unit/Application/Model/UserEntityTest.php index c5853d8..046e894 100644 --- a/src/tests/unit/Application/Model/UserEntityTest.php +++ b/src/tests/unit/Application/Model/UserEntityTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/WebauthnAfterLoginTest.php b/src/tests/unit/Application/Model/WebauthnAfterLoginTest.php index edeef73..4c6f0fe 100644 --- a/src/tests/unit/Application/Model/WebauthnAfterLoginTest.php +++ b/src/tests/unit/Application/Model/WebauthnAfterLoginTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/WebauthnErrorsTest.php b/src/tests/unit/Application/Model/WebauthnErrorsTest.php index ffbc786..cfdb977 100644 --- a/src/tests/unit/Application/Model/WebauthnErrorsTest.php +++ b/src/tests/unit/Application/Model/WebauthnErrorsTest.php @@ -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; diff --git a/src/tests/unit/Application/Model/WebauthnLoginTest.php b/src/tests/unit/Application/Model/WebauthnLoginTest.php index eac63f5..c6ce5ce 100644 --- a/src/tests/unit/Application/Model/WebauthnLoginTest.php +++ b/src/tests/unit/Application/Model/WebauthnLoginTest.php @@ -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)); diff --git a/src/tests/unit/Application/Model/WebauthnTest.php b/src/tests/unit/Application/Model/WebauthnTest.php index 247e565..f1db94f 100644 --- a/src/tests/unit/Application/Model/WebauthnTest.php +++ b/src/tests/unit/Application/Model/WebauthnTest.php @@ -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; diff --git a/src/tests/unit/Modules/Application/Component/UserComponentWebauthnTest.php b/src/tests/unit/Modules/Application/Component/UserComponentWebauthnTest.php index e92720f..ccc7a5c 100644 --- a/src/tests/unit/Modules/Application/Component/UserComponentWebauthnTest.php +++ b/src/tests/unit/Modules/Application/Component/UserComponentWebauthnTest.php @@ -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; diff --git a/src/tests/unit/Modules/Application/Controller/Admin/LoginControllerWebauthnTest.php b/src/tests/unit/Modules/Application/Controller/Admin/LoginControllerWebauthnTest.php index fc9d1fc..b985756 100644 --- a/src/tests/unit/Modules/Application/Controller/Admin/LoginControllerWebauthnTest.php +++ b/src/tests/unit/Modules/Application/Controller/Admin/LoginControllerWebauthnTest.php @@ -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; diff --git a/src/tests/unit/Modules/Application/Controller/CheckoutTestTrait.php b/src/tests/unit/Modules/Application/Controller/CheckoutTestTrait.php index 4c9d43b..beecb84 100644 --- a/src/tests/unit/Modules/Application/Controller/CheckoutTestTrait.php +++ b/src/tests/unit/Modules/Application/Controller/CheckoutTestTrait.php @@ -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; diff --git a/src/tests/unit/Modules/Application/Model/UserWebauthnTest.php b/src/tests/unit/Modules/Application/Model/UserWebauthnTest.php index f966e33..0041391 100644 --- a/src/tests/unit/Modules/Application/Model/UserWebauthnTest.php +++ b/src/tests/unit/Modules/Application/Model/UserWebauthnTest.php @@ -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;