Skip to content

Commit 8ae6dfb

Browse files
Merge branch 'develop' into ds_fix-docs
2 parents 9c4c75c + a8391f0 commit 8ae6dfb

File tree

24 files changed

+187
-47
lines changed

24 files changed

+187
-47
lines changed

ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function testProcess(array $mocks, array $expected): void
119119
$this->assertSame($expected, $actual);
120120
}
121121

122-
public function processDataProvider(): array
122+
public static function processDataProvider(): array
123123
{
124124
return [
125125
[

ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testProcess(array $mocks, array $expected): void
107107
/**
108108
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
109109
*/
110-
public function processDataProvider(): array
110+
public static function processDataProvider(): array
111111
{
112112
return [
113113
[

ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function testExecute(array $mocks): void
114114
$this->model->execute($this->observer);
115115
}
116116

117-
public function executeDataProvider(): array
117+
public static function executeDataProvider(): array
118118
{
119119
return [
120120
[
@@ -131,7 +131,7 @@ public function executeDataProvider(): array
131131
'reCaptchaSession' => [
132132
[
133133
'method' => 'save',
134-
'expects' => $this->never(),
134+
'expects' => self::never(),
135135
]
136136
]
137137
]
@@ -150,20 +150,20 @@ public function executeDataProvider(): array
150150
'reCaptchaSession' => [
151151
[
152152
'method' => 'save',
153-
'expects' => $this->never(),
153+
'expects' => self::never(),
154154
]
155155
],
156156
'captchaValidator' => [
157157
[
158158
'method' => 'isValid',
159-
'expects' => $this->once(),
159+
'expects' => self::once(),
160160
'willReturnProperty' => 'validationResult'
161161
]
162162
],
163163
'validationResult' => [
164164
[
165165
'method' => 'isValid',
166-
'expects' => $this->once(),
166+
'expects' => self::once(),
167167
'willReturn' => true,
168168
]
169169
]
@@ -183,20 +183,20 @@ public function executeDataProvider(): array
183183
'reCaptchaSession' => [
184184
[
185185
'method' => 'save',
186-
'expects' => $this->once(),
186+
'expects' => self::once(),
187187
]
188188
],
189189
'captchaValidator' => [
190190
[
191191
'method' => 'isValid',
192-
'expects' => $this->once(),
192+
'expects' => self::once(),
193193
'willReturnProperty' => 'validationResult'
194194
]
195195
],
196196
'validationResult' => [
197197
[
198198
'method' => 'isValid',
199-
'expects' => $this->once(),
199+
'expects' => self::once(),
200200
'willReturn' => true,
201201
]
202202
]

ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ public function testAfterGetConfigFor(array $mocks, bool $isResultNull, bool $is
9696
/**
9797
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
9898
*/
99-
public function afterGetConfigForDataProvider(): array
99+
public static function afterGetConfigForDataProvider(): array
100100
{
101101
return [
102102
[
103103
[
104104
'reCaptchaSession' => [
105-
['method' => 'isValid', 'expects' => $this->never()]
105+
['method' => 'isValid', 'expects' => self::never()]
106106
]
107107
],
108108
true,
@@ -114,7 +114,7 @@ public function afterGetConfigForDataProvider(): array
114114
['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => false]
115115
],
116116
'reCaptchaSession' => [
117-
['method' => 'isValid', 'expects' => $this->never(),]
117+
['method' => 'isValid', 'expects' => self::never(),]
118118
]
119119
],
120120
false,
@@ -126,10 +126,10 @@ public function afterGetConfigForDataProvider(): array
126126
['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true]
127127
],
128128
'request' => [
129-
['method' => 'getBodyParams', 'expects' => $this->once(), 'willReturn' => []]
129+
['method' => 'getBodyParams', 'expects' => self::once(), 'willReturn' => []]
130130
],
131131
'reCaptchaSession' => [
132-
['method' => 'isValid', 'expects' => $this->never(),]
132+
['method' => 'isValid', 'expects' => self::never(),]
133133
]
134134
],
135135
false,
@@ -143,12 +143,12 @@ public function afterGetConfigForDataProvider(): array
143143
'request' => [
144144
[
145145
'method' => 'getBodyParams',
146-
'expects' => $this->once(),
146+
'expects' => self::once(),
147147
'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => 'checkmo']]
148148
]
149149
],
150150
'reCaptchaSession' => [
151-
['method' => 'isValid', 'expects' => $this->never(), 'willReturn' => false]
151+
['method' => 'isValid', 'expects' => self::never(), 'willReturn' => false]
152152
]
153153
],
154154
false,
@@ -162,12 +162,12 @@ public function afterGetConfigForDataProvider(): array
162162
'request' => [
163163
[
164164
'method' => 'getBodyParams',
165-
'expects' => $this->once(),
165+
'expects' => self::once(),
166166
'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]]
167167
]
168168
],
169169
'reCaptchaSession' => [
170-
['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => false]
170+
['method' => 'isValid', 'expects' => self::once(), 'with' => 1, 'willReturn' => false]
171171
]
172172
],
173173
false,
@@ -181,12 +181,12 @@ public function afterGetConfigForDataProvider(): array
181181
'request' => [
182182
[
183183
'method' => 'getBodyParams',
184-
'expects' => $this->once(),
184+
'expects' => self::once(),
185185
'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]]
186186
]
187187
],
188188
'reCaptchaSession' => [
189-
['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => true]
189+
['method' => 'isValid', 'expects' => self::once(), 'with' => 1, 'willReturn' => true]
190190
]
191191
],
192192
false,
@@ -200,15 +200,15 @@ public function afterGetConfigForDataProvider(): array
200200
'request' => [
201201
[
202202
'method' => 'getBodyParams',
203-
'expects' => $this->once(),
203+
'expects' => self::once(),
204204
'willReturn' => [
205205
'cart_id' => 1,
206206
'payment_method' => ['method' => Config::METHOD_PAYFLOWPRO]
207207
]
208208
]
209209
],
210210
'reCaptchaSession' => [
211-
['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => true]
211+
['method' => 'isValid', 'expects' => self::once(), 'with' => 1, 'willReturn' => true]
212212
]
213213
],
214214
false,
@@ -222,7 +222,7 @@ public function afterGetConfigForDataProvider(): array
222222
'request' => [
223223
[
224224
'method' => 'getBodyParams',
225-
'expects' => $this->once(),
225+
'expects' => self::once(),
226226
'willReturn' => [
227227
'cartId' => '17uc43rge98nc92',
228228
'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]
@@ -232,24 +232,24 @@ public function afterGetConfigForDataProvider(): array
232232
'quoteIdMaskFactory' => [
233233
[
234234
'method' => 'create',
235-
'expects' => $this->once(),
235+
'expects' => self::once(),
236236
'willReturnProperty' => 'quoteIdMask'
237237
]
238238
],
239239
'quoteIdMask' => [
240240
[
241241
'method' => 'load',
242-
'expects' => $this->once(),
242+
'expects' => self::once(),
243243
'willReturnSelf' => null
244244
],
245245
[
246246
'method' => 'getQuoteId',
247-
'expects' => $this->once(),
247+
'expects' => self::once(),
248248
'willReturn' => 2
249249
]
250250
],
251251
'reCaptchaSession' => [
252-
['method' => 'isValid', 'expects' => $this->once(), 'with' => 2, 'willReturn' => true]
252+
['method' => 'isValid', 'expects' => self::once(), 'with' => 2, 'willReturn' => true]
253253
]
254254
],
255255
false,

ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testAddProductReviewReCaptchaValidationFailed(string $customerNa
7070
/**
7171
* @return array
7272
*/
73-
public function customerDataProvider(): array
73+
public static function customerDataProvider(): array
7474
{
7575
return [
7676
'Guest' => ['John Doe', true],

ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function resolve(
8282
'badge_position' => $this->reCaptchaV3Config->getBadgePosition(),
8383
'language_code' => $this->reCaptchaV3Config->getLanguageCode(),
8484
'failure_message' => $this->getFailureMessage(),
85-
'forms' => $this->getEnumFormTypes()
85+
'forms' => $this->getEnumFormTypes(),
86+
'theme' => $this->reCaptchaV3Config->getTheme()
8687
];
8788
}
8889

ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\ReCaptchaWebapiGraphQl\Test\Api;
99

10+
use Exception;
1011
use Magento\Framework\Encryption\EncryptorInterface;
1112
use Magento\TestFramework\Fixture\Config;
1213
use Magento\Framework\App\ResourceConnection;
@@ -29,6 +30,7 @@ class ReCaptchaV3ConfigTest extends GraphQlAbstract
2930
language_code
3031
failure_message
3132
forms
33+
theme
3234
}
3335
}
3436
QUERY;
@@ -49,6 +51,7 @@ public function setUp(): void
4951
Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75),
5052
Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'),
5153
Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'),
54+
Config('recaptcha_frontend/type_recaptcha_v3/theme', 'light'),
5255
Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'),
5356
Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3')
5457
]
@@ -65,7 +68,8 @@ public function testQueryRecaptchaNoPublicKeyConfigured(): void
6568
'failure_message' => 'Test failure message',
6669
'forms' => [
6770
'CUSTOMER_LOGIN'
68-
]
71+
],
72+
'theme' => 'light'
6973
]
7074
],
7175
$this->graphQlQuery(self::QUERY)
@@ -76,6 +80,7 @@ public function testQueryRecaptchaNoPublicKeyConfigured(): void
7680
Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75),
7781
Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'),
7882
Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'),
83+
Config('recaptcha_frontend/type_recaptcha_v3/theme', 'light'),
7984
Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message')
8085
]
8186
public function testQueryRecaptchaNoFormsConfigured(): void
@@ -100,7 +105,8 @@ public function testQueryRecaptchaNoFormsConfigured(): void
100105
'badge_position' => 'bottomright',
101106
'language_code' => 'en',
102107
'failure_message' => 'Test failure message',
103-
'forms' => []
108+
'forms' => [],
109+
'theme' => 'light'
104110
]
105111
],
106112
$this->graphQlQuery(self::QUERY)
@@ -111,6 +117,7 @@ public function testQueryRecaptchaNoFormsConfigured(): void
111117
Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75),
112118
Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'),
113119
Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'),
120+
Config('recaptcha_frontend/type_recaptcha_v3/theme', 'dark'),
114121
Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'),
115122
Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3')
116123
]
@@ -138,7 +145,8 @@ public function testQueryRecaptchaConfigured(): void
138145
'failure_message' => 'Test failure message',
139146
'forms' => [
140147
'CUSTOMER_LOGIN'
141-
]
148+
],
149+
'theme' => 'dark'
142150
]
143151
],
144152
$this->graphQlQuery(self::QUERY)
@@ -151,7 +159,7 @@ public function tearDown(): void
151159
$resource = Bootstrap::getObjectManager()->get(ResourceConnection::class);
152160
/** @var AdapterInterface $connection */
153161
$connection = $resource->getConnection(ResourceConnection::DEFAULT_CONNECTION);
154-
162+
155163
$connection->delete(
156164
$resource->getTableName('core_config_data')
157165
);

ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use PHPUnit\Framework\TestCase;
2424
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
2525

26+
/**
27+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28+
*/
2629
class GraphQlValidatorTest extends TestCase
2730
{
2831
/**
@@ -60,7 +63,7 @@ protected function setUp(): void
6063
);
6164
}
6265

63-
public function getPluginCases(): array
66+
public static function getPluginCases(): array
6467
{
6568
return [
6669
'not-mutation' => [false, true, false, false],

ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function setUp(): void
3535
$this->model = new ValidationOverrider($this->userContextMock);
3636
}
3737

38-
public function getUserContextData(): array
38+
public static function getUserContextData(): array
3939
{
4040
return [
4141
'customer' => [UserContextInterface::USER_TYPE_CUSTOMER, 1, true],

ReCaptchaWebapiGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ type ReCaptchaConfigurationV3 @doc(description: "Contains reCAPTCHA V3-Invisible
5050
language_code: String @doc(description: "A two-character code that specifies the language that is used for Google reCAPTCHA text and messaging.")
5151
failure_message: String! @doc(description: "The message that appears to the user if validation fails.")
5252
forms: [ReCaptchaFormEnum!]! @doc(description: "A list of forms on the storefront that have been configured to use reCAPTCHA V3.")
53+
theme: String! @doc(description: "Theme to be used to render reCaptcha.")
5354
}

0 commit comments

Comments
 (0)