Skip to content

Commit a91106f

Browse files
committed
MC-30537: Test automation with the new 2FA enabled by default
- Static fixes
1 parent adf1c60 commit a91106f

File tree

24 files changed

+48
-32
lines changed

24 files changed

+48
-32
lines changed

TwoFactorAuth/Api/TfaInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function getProvidersToActivate(int $userId): array;
9696
* @param int $userId
9797
* @param string $providerCode
9898
* @return bool
99+
* @SuppressWarnings(PHPMD.BooleanGetMethodName)
99100
*/
100101
public function getProviderIsAllowed(int $userId, string $providerCode): bool;
101102

TwoFactorAuth/Block/Provider/Authy/Configure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(
3737
/**
3838
* Get a country list
3939
*
40-
* return array
40+
* @return array
4141
*/
4242
private function getCountriesList()
4343
{

TwoFactorAuth/Command/TfaProviders.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5555
foreach ($providers as $provider) {
5656
$output->writeln(sprintf("%16s: %s", $provider->getCode(), $provider->getName()));
5757
}
58+
59+
return 0;
5860
}
5961
}

TwoFactorAuth/Command/TfaReset.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9898
$this->userConfigManager->resetProviderConfig((int) $user->getId(), $providerCode);
9999

100100
$output->writeln('' . __('Provider %1 has been reset for user %2', $provider->getName(), $userName));
101+
102+
return 0;
101103
}
102104
}

TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ class Auth extends AbstractAction implements HttpGetActionInterface
4848
*/
4949
private $tokenVerifier;
5050

51+
/**
52+
* @param Action\Context $context
53+
* @param Session $session
54+
* @param PageFactory $pageFactory
55+
* @param UserConfigManagerInterface $userConfigManager
56+
* @param TfaInterface $tfa
57+
* @param HtmlAreaTokenVerifier $tokenVerifier
58+
*/
5159
public function __construct(
5260
Action\Context $context,
5361
Session $session,
@@ -66,6 +74,7 @@ public function __construct(
6674

6775
/**
6876
* Get current user
77+
*
6978
* @return \Magento\User\Model\User|null
7079
*/
7180
private function getUser()

TwoFactorAuth/Controller/Adminhtml/Tfa/Index.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public function __construct(
8989
* @inheritdoc
9090
*
9191
* @throws LocalizedException
92+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
93+
* @SuppressWarnings(PHPMD.NPathComplexity)
9294
*/
9395
public function execute()
9496
{

TwoFactorAuth/Model/EmailUserNotifier.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,6 @@ class EmailUserNotifier implements UserNotifierInterface
4545
*/
4646
private $logger;
4747

48-
/**
49-
* @var UrlInterface
50-
*/
51-
private $url;
52-
53-
/**
54-
* @var State
55-
*/
56-
private $appState;
57-
5848
/**
5949
* @var UserNotifierConfig
6050
*/
@@ -66,7 +56,6 @@ class EmailUserNotifier implements UserNotifierInterface
6656
* @param StoreManagerInterface $storeManager
6757
* @param LoggerInterface $logger
6858
* @param UrlInterface $url
69-
* @param State $appState
7059
* @param UserNotifierConfig $userNotifierConfig
7160
*/
7261
public function __construct(
@@ -75,15 +64,13 @@ public function __construct(
7564
StoreManagerInterface $storeManager,
7665
LoggerInterface $logger,
7766
UrlInterface $url,
78-
State $appState,
7967
UserNotifierConfig $userNotifierConfig
8068
) {
8169
$this->scopeConfig = $scopeConfig;
8270
$this->transportBuilder = $transportBuilder;
8371
$this->storeManager = $storeManager;
8472
$this->logger = $logger;
8573
$this->url = $url;
86-
$this->appState = $appState;
8774
$this->userNotifierConfig = $userNotifierConfig;
8875
}
8976

@@ -154,14 +141,4 @@ public function sendAppConfigRequestMessage(User $user, string $token): void
154141
$this->userNotifierConfig->getAppRequestConfigUrl($token)
155142
);
156143
}
157-
158-
/**
159-
* Determine if the environment is webapi or not
160-
*
161-
* @return bool
162-
*/
163-
private function isWebapi(): bool
164-
{
165-
return in_array($this->appState->getAreaCode(), [Area::AREA_WEBAPI_REST, Area::AREA_WEBAPI_SOAP]);
166-
}
167144
}

TwoFactorAuth/Model/Provider/Engine/Authy/Authenticate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
/**
2323
* Authenticate a user with authy
24+
*
25+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2426
*/
2527
class Authenticate implements AuthyAuthenticateInterface
2628
{

TwoFactorAuth/Model/Provider/Engine/Google.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
/**
2828
* Google authenticator engine
29+
*
30+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2931
*/
3032
class Google implements EngineInterface
3133
{

TwoFactorAuth/Model/Provider/Engine/U2fKey/Authenticate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
/**
2727
* Authenticate with the u2f provider and get an admin token
28+
*
29+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2830
*/
2931
class Authenticate implements U2fKeyAuthenticateInterface
3032
{

0 commit comments

Comments
 (0)