File tree 3 files changed +13
-8
lines changed
3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ HTTP_REFERER
59
59
SERVER_NAME
60
60
```
61
61
62
- Server variables can be passed to the ` test() ` method .
62
+ Server variables can be passed to the ` test() ` and ` share() ` methods .
63
63
``` php
64
64
$serverVariables = ServerVariables::default()->with(
65
65
ServerVariable::SERVER_NAME,
@@ -72,4 +72,11 @@ $response = $client->test(
72
72
RewriteRule .* /foo [R]',
73
73
$serverVariables
74
74
);
75
+
76
+ $response = $client->share(
77
+ 'http://localhost',
78
+ 'RewriteCond %{SERVER_NAME} example.com
79
+ RewriteRule .* /foo [R]',
80
+ $serverVariables
81
+ );
75
82
```
Original file line number Diff line number Diff line change @@ -57,17 +57,16 @@ function (array $line) {
57
57
public function share (
58
58
string $ url ,
59
59
string $ htaccess ,
60
- ?string $ referrer = '' ,
61
- ?string $ serverName = ''
60
+ ?ServerVariables $ serverVariables = null
62
61
): ShareResult {
62
+ $ serverVariables = $ serverVariables ?? ServerVariables::default ();
63
63
$ responseData = $ this ->request (
64
64
'POST ' ,
65
65
'/share ' ,
66
66
[
67
67
'url ' => $ url ,
68
68
'htaccess ' => $ htaccess ,
69
- 'referrer ' => $ referrer ?? '' ,
70
- 'server_name ' => $ serverName ?? '' ,
69
+ 'serverVariables ' => $ serverVariables ->toArray ()
71
70
]
72
71
);
73
72
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ public function it can share a test run with a referer(): void
189
189
'http://localhost ' ,
190
190
'RewriteCond %{HTTP_REFERER} http://example.com
191
191
RewriteRule .* /example-page [L] ' ,
192
- 'http://example.com '
192
+ ServerVariables:: default ()-> with (ServerVariable:: HTTP_REFERER , 'http://example.com ' )
193
193
);
194
194
195
195
$ this ->assertStringStartsWith (
@@ -222,8 +222,7 @@ public function it can share a test run with a server name(): void
222
222
'http://localhost ' ,
223
223
'RewriteCond %{SERVER_NAME} example.com
224
224
RewriteRule .* /example-page [L] ' ,
225
- null ,
226
- 'example.com '
225
+ ServerVariables::default ()->with (ServerVariable::SERVER_NAME , 'example.com ' )
227
226
);
228
227
229
228
$ this ->assertStringStartsWith (
You can’t perform that action at this time.
0 commit comments