@@ -29,6 +29,8 @@ function (
29
29
string |null $ waitForExpression = null ,
30
30
string |null $ emulatedMediaType = null ,
31
31
array $ cookies = [],
32
+ string |null $ basicAuthenticationUsername = null ,
33
+ string |null $ basicAuthenticationPassword = null ,
32
34
string |null $ userAgent = null ,
33
35
array $ extraHttpHeaders = [],
34
36
array $ failOnHttpStatusCodes = [],
@@ -50,6 +52,8 @@ function (
50
52
$ waitForExpression ,
51
53
$ emulatedMediaType ,
52
54
$ cookies ,
55
+ $ basicAuthenticationUsername ,
56
+ $ basicAuthenticationPassword ,
53
57
$ userAgent ,
54
58
$ extraHttpHeaders ,
55
59
$ failOnHttpStatusCodes ,
@@ -77,6 +81,8 @@ function (
77
81
$ waitForExpression ,
78
82
$ emulatedMediaType ,
79
83
$ cookies ,
84
+ $ basicAuthenticationUsername ,
85
+ $ basicAuthenticationPassword ,
80
86
$ userAgent ,
81
87
$ extraHttpHeaders ,
82
88
$ failOnHttpStatusCodes ,
@@ -103,6 +109,8 @@ function (
103
109
new ChromiumCookie ('yummy_cookie ' , 'choco ' , 'theyummycookie.com ' ),
104
110
new ChromiumCookie ('vanilla_cookie ' , 'vanilla ' , 'theyummycookie.com ' , '/ ' , true , true , 'Lax ' ),
105
111
],
112
+ 'username ' ,
113
+ 'password ' ,
106
114
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' ,
107
115
[
108
116
'My-Http-Header ' => 'HTTP Header content ' ,
@@ -138,6 +146,8 @@ function (
138
146
string |null $ waitForExpression = null ,
139
147
string |null $ emulatedMediaType = null ,
140
148
array $ cookies = [],
149
+ string |null $ basicAuthenticationUsername = null ,
150
+ string |null $ basicAuthenticationPassword = null ,
141
151
string |null $ userAgent = null ,
142
152
array $ extraHttpHeaders = [],
143
153
array $ failOnHttpStatusCodes = [],
@@ -159,6 +169,8 @@ function (
159
169
$ waitForExpression ,
160
170
$ emulatedMediaType ,
161
171
$ cookies ,
172
+ $ basicAuthenticationUsername ,
173
+ $ basicAuthenticationPassword ,
162
174
$ userAgent ,
163
175
$ extraHttpHeaders ,
164
176
$ failOnHttpStatusCodes ,
@@ -188,6 +200,8 @@ function (
188
200
$ waitForExpression ,
189
201
$ emulatedMediaType ,
190
202
$ cookies ,
203
+ $ basicAuthenticationUsername ,
204
+ $ basicAuthenticationPassword ,
191
205
$ userAgent ,
192
206
$ extraHttpHeaders ,
193
207
$ failOnHttpStatusCodes ,
@@ -214,6 +228,8 @@ function (
214
228
new ChromiumCookie ('yummy_cookie ' , 'choco ' , 'theyummycookie.com ' ),
215
229
new ChromiumCookie ('vanilla_cookie ' , 'vanilla ' , 'theyummycookie.com ' , '/ ' , true , true , 'Lax ' ),
216
230
],
231
+ 'username ' ,
232
+ 'password ' ,
217
233
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' ,
218
234
[
219
235
'My-Http-Header ' => 'Http Header content ' ,
@@ -251,6 +267,8 @@ function (
251
267
string |null $ waitForExpression = null ,
252
268
string |null $ emulatedMediaType = null ,
253
269
array $ cookies = [],
270
+ string |null $ basicAuthenticationUsername = null ,
271
+ string |null $ basicAuthenticationPassword = null ,
254
272
string |null $ userAgent = null ,
255
273
array $ extraHttpHeaders = [],
256
274
array $ failOnHttpStatusCodes = [],
@@ -272,6 +290,8 @@ function (
272
290
$ waitForExpression ,
273
291
$ emulatedMediaType ,
274
292
$ cookies ,
293
+ $ basicAuthenticationUsername ,
294
+ $ basicAuthenticationPassword ,
275
295
$ userAgent ,
276
296
$ extraHttpHeaders ,
277
297
$ failOnHttpStatusCodes ,
@@ -306,6 +326,8 @@ function (
306
326
$ waitForExpression ,
307
327
$ emulatedMediaType ,
308
328
$ cookies ,
329
+ $ basicAuthenticationUsername ,
330
+ $ basicAuthenticationPassword ,
309
331
$ userAgent ,
310
332
$ extraHttpHeaders ,
311
333
$ failOnHttpStatusCodes ,
@@ -341,6 +363,8 @@ function (
341
363
new ChromiumCookie ('yummy_cookie ' , 'choco ' , 'theyummycookie.com ' ),
342
364
new ChromiumCookie ('vanilla_cookie ' , 'vanilla ' , 'theyummycookie.com ' , '/ ' , true , true , 'Lax ' ),
343
365
],
366
+ 'username ' ,
367
+ 'password ' ,
344
368
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' ,
345
369
[
346
370
'My-Http-Header ' => 'Http Header content ' ,
@@ -374,6 +398,8 @@ function hydrateChromiumScreenshotFormData(
374
398
string |null $ waitForExpression = null ,
375
399
string |null $ emulatedMediaType = null ,
376
400
array $ cookies = [],
401
+ string |null $ basicAuthenticationUsername = null ,
402
+ string |null $ basicAuthenticationPassword = null ,
377
403
string |null $ userAgent = null ,
378
404
array $ extraHttpHeaders = [],
379
405
array $ failOnHttpStatusCodes = [],
@@ -437,6 +463,10 @@ function hydrateChromiumScreenshotFormData(
437
463
$ chromium ->cookies ($ cookies );
438
464
}
439
465
466
+ if ($ basicAuthenticationUsername !== null && $ basicAuthenticationPassword !== null ) {
467
+ $ chromium ->basicAuthentication ($ basicAuthenticationUsername , $ basicAuthenticationPassword );
468
+ }
469
+
440
470
if ($ userAgent !== null ) {
441
471
$ chromium ->userAgent ($ userAgent );
442
472
}
@@ -483,6 +513,8 @@ function expectChromiumScreenshotOptions(
483
513
string |null $ waitForExpression ,
484
514
string |null $ emulatedMediaType ,
485
515
array $ cookies ,
516
+ string |null $ basicAuthenticationUsername ,
517
+ string |null $ basicAuthenticationPassword ,
486
518
string |null $ userAgent ,
487
519
array $ extraHttpHeaders ,
488
520
array $ failOnHttpStatusCodes ,
@@ -510,6 +542,10 @@ function expectChromiumScreenshotOptions(
510
542
expect ($ body )->toContainFormValue ('cookies ' , $ json );
511
543
}
512
544
545
+ expect ($ body )->unless ($ basicAuthenticationUsername === null && $ basicAuthenticationPassword === null , fn ($ body ) => [
546
+ $ body ->toContainFormValue ('basicAuthenticationUsername ' , $ basicAuthenticationUsername ),
547
+ $ body ->toContainFormValue ('basicAuthenticationPassword ' , $ basicAuthenticationPassword ),
548
+ ]);
513
549
expect ($ body )->unless ($ userAgent === null , fn ($ body ) => $ body ->toContainFormValue ('userAgent ' , $ userAgent ));
514
550
515
551
if (count ($ extraHttpHeaders ) > 0 ) {
0 commit comments