@@ -19,44 +19,44 @@ public function getNewCommand(): Command
19
19
public function testBuildMinimal (): void
20
20
{
21
21
$ command = new Command ();
22
- $ this ->assertEquals ('curl ' , $ command ->build ());
22
+ $ this ->assertSame ('curl ' , $ command ->build ());
23
23
}
24
24
25
25
public function testBuildWithUrl (): void
26
26
{
27
27
$ command = new Command ();
28
28
$ command ->setUrl ('http://example.com/test ' );
29
- $ this ->assertEquals ('curl http://example.com/test ' , $ command ->build ());
29
+ $ this ->assertSame ('curl http://example.com/test ' , $ command ->build ());
30
30
}
31
31
32
32
public function testBuildWithOption (): void
33
33
{
34
34
$ command = new Command ();
35
35
$ command ->addOption ('-v ' );
36
- $ this ->assertEquals ('curl -v ' , $ command ->build ());
36
+ $ this ->assertSame ('curl -v ' , $ command ->build ());
37
37
}
38
38
39
39
public function testBuildWithOptions (): void
40
40
{
41
41
$ command = new Command ();
42
42
$ command ->addOption ('-v ' );
43
43
$ command ->addOption ('-L ' );
44
- $ this ->assertEquals ('curl -v -L ' , $ command ->build ());
44
+ $ this ->assertSame ('curl -v -L ' , $ command ->build ());
45
45
}
46
46
47
47
public function testBuildWithUrlAndOption (): void
48
48
{
49
49
$ command = $ this ->getNewCommand ();
50
50
$ command ->addOption ('-v ' );
51
- $ this ->assertEquals ('curl -v http://example.com ' , $ command ->build ());
51
+ $ this ->assertSame ('curl -v http://example.com ' , $ command ->build ());
52
52
}
53
53
54
54
public function testBuildWithUrlAndOptions (): void
55
55
{
56
56
$ command = $ this ->getNewCommand ();
57
57
$ command ->addOption ('-v ' );
58
58
$ command ->addOption ('-L ' );
59
- $ this ->assertEquals ('curl -v -L http://example.com ' , $ command ->build ());
59
+ $ this ->assertSame ('curl -v -L http://example.com ' , $ command ->build ());
60
60
61
61
62
62
}
@@ -66,26 +66,26 @@ public function testBuildSetOptions(): void
66
66
$ command = $ this ->getNewCommand ();
67
67
68
68
$ command ->setOptions ([]);
69
- $ this ->assertEquals ('curl http://example.com ' , $ command ->build ());
69
+ $ this ->assertSame ('curl http://example.com ' , $ command ->build ());
70
70
71
71
$ command ->setOptions (['-L ' => [null ], '-v ' => [null ]]);
72
- $ this ->assertEquals ('curl -L -v http://example.com ' , $ command ->build ());
72
+ $ this ->assertSame ('curl -L -v http://example.com ' , $ command ->build ());
73
73
74
74
$ command ->setOptions (['-L ' => null , '-v ' => null ]);
75
- $ this ->assertEquals ('curl -L -v http://example.com ' , $ command ->build ());
75
+ $ this ->assertSame ('curl -L -v http://example.com ' , $ command ->build ());
76
76
77
77
$ command ->setOptions (['-d ' => 'test1 ' , '-H ' => 'test2 ' ]);
78
- $ this ->assertEquals ("curl -d 'test1' -H 'test2' http://example.com " , $ command ->build ());
78
+ $ this ->assertSame ("curl -d 'test1' -H 'test2' http://example.com " , $ command ->build ());
79
79
80
80
$ command ->setOptions (['-H ' => ['test1 ' , 'test2 ' ]]);
81
- $ this ->assertEquals ("curl -H 'test1' -H 'test2' http://example.com " , $ command ->build ());
81
+ $ this ->assertSame ("curl -H 'test1' -H 'test2' http://example.com " , $ command ->build ());
82
82
83
83
$ command ->setOptions (['-L ' , '-v ' ]);
84
- $ this ->assertEquals ('curl -L -v http://example.com ' , $ command ->build ());
84
+ $ this ->assertSame ('curl -L -v http://example.com ' , $ command ->build ());
85
85
86
86
// mixed format
87
87
$ command ->setOptions (['-L ' , '-v ' => null , '--insecure ' => [null ], '-d ' => 'test1 ' , '-H ' => ['test2 ' ]]);
88
- $ this ->assertEquals ("curl -L -v --insecure -d 'test1' -H 'test2' http://example.com " , $ command ->build ());
88
+ $ this ->assertSame ("curl -L -v --insecure -d 'test1' -H 'test2' http://example.com " , $ command ->build ());
89
89
}
90
90
91
91
public function testBuildDuplicatedOptions (): void
@@ -94,7 +94,7 @@ public function testBuildDuplicatedOptions(): void
94
94
$ command ->addOption ('-v ' );
95
95
$ command ->addOption ('-L ' );
96
96
$ command ->addOption ('-L ' );
97
- $ this ->assertEquals ('curl -v -L -L http://example.com ' , $ command ->build ());
97
+ $ this ->assertSame ('curl -v -L -L http://example.com ' , $ command ->build ());
98
98
}
99
99
100
100
public function testBuildSetTemplate (): void
@@ -103,40 +103,40 @@ public function testBuildSetTemplate(): void
103
103
$ command ->setTemplate (Command::TEMPLATE_COMMAND_NAME . Command::TEMPLATE_URL . Command::TEMPLATE_OPTIONS );
104
104
$ command ->addOption ('-v ' );
105
105
$ command ->addOption ('-L ' );
106
- $ this ->assertEquals ('curl http://example.com -v -L ' , $ command ->build ());
106
+ $ this ->assertSame ('curl http://example.com -v -L ' , $ command ->build ());
107
107
108
108
$ command ->setTemplate (Command::TEMPLATE_COMMAND_NAME . Command::TEMPLATE_URL );
109
- $ this ->assertEquals ('curl http://example.com ' , $ command ->build ());
109
+ $ this ->assertSame ('curl http://example.com ' , $ command ->build ());
110
110
111
111
$ command ->setTemplate ('' );
112
- $ this ->assertEquals ('' , $ command ->build ());
112
+ $ this ->assertSame ('' , $ command ->build ());
113
113
}
114
114
115
115
public function testBuildWithLongOptions (): void
116
116
{
117
117
$ command = $ this ->getNewCommand ();
118
118
$ command ->addOption ('--verbose ' );
119
- $ this ->assertEquals ('curl --verbose http://example.com ' , $ command ->build ());
119
+ $ this ->assertSame ('curl --verbose http://example.com ' , $ command ->build ());
120
120
121
121
$ command ->addOption ('--location ' );
122
- $ this ->assertEquals ('curl --verbose --location http://example.com ' , $ command ->build ());
122
+ $ this ->assertSame ('curl --verbose --location http://example.com ' , $ command ->build ());
123
123
}
124
124
125
125
public function testBuildWithArgumentsToOptions (): void
126
126
{
127
127
$ command = $ this ->getNewCommand ();
128
128
$ command ->addOption ('-d ' , 'arbitrary ' );
129
- $ this ->assertEquals ("curl -d 'arbitrary' http://example.com " , $ command ->build ());
129
+ $ this ->assertSame ("curl -d 'arbitrary' http://example.com " , $ command ->build ());
130
130
131
131
// data from file
132
132
$ command = $ this ->getNewCommand ();
133
133
$ command ->addOption ('-d ' , '@json.txt ' );
134
- $ this ->assertEquals ("curl -d '@json.txt' http://example.com " , $ command ->build ());
134
+ $ this ->assertSame ("curl -d '@json.txt' http://example.com " , $ command ->build ());
135
135
136
136
// argument with spaces
137
137
$ command = $ this ->getNewCommand ();
138
138
$ command ->addOption ('-d ' , 'I am your father ' );
139
- $ this ->assertEquals ("curl -d 'I am your father' http://example.com " , $ command ->build ());
139
+ $ this ->assertSame ("curl -d 'I am your father' http://example.com " , $ command ->build ());
140
140
}
141
141
142
142
public function testBuildSetQuoteCharacter (): void
@@ -145,16 +145,16 @@ public function testBuildSetQuoteCharacter(): void
145
145
$ command ->addOption ('-d ' , 'arbitrary ' );
146
146
147
147
// default is singe
148
- $ this ->assertEquals ("curl -d 'arbitrary' http://example.com " , $ command ->build ());
148
+ $ this ->assertSame ("curl -d 'arbitrary' http://example.com " , $ command ->build ());
149
149
150
150
$ command ->setQuoteCharacter (Command::QUOTE_DOUBLE );
151
- $ this ->assertEquals ('curl -d "arbitrary" http://example.com ' , $ command ->build ());
151
+ $ this ->assertSame ('curl -d "arbitrary" http://example.com ' , $ command ->build ());
152
152
153
153
$ command ->setQuoteCharacter (Command::QUOTE_SINGLE );
154
- $ this ->assertEquals ("curl -d 'arbitrary' http://example.com " , $ command ->build ());
154
+ $ this ->assertSame ("curl -d 'arbitrary' http://example.com " , $ command ->build ());
155
155
156
156
$ command ->setQuoteCharacter (Command::QUOTE_NONE );
157
- $ this ->assertEquals ('curl -d arbitrary http://example.com ' , $ command ->build ());
157
+ $ this ->assertSame ('curl -d arbitrary http://example.com ' , $ command ->build ());
158
158
}
159
159
160
160
public function testBuildEscapeArguments (): void
@@ -168,7 +168,7 @@ public function testBuildEscapeArguments(): void
168
168
$ command = $ this ->getNewCommand ();
169
169
$ command ->setQuoteCharacter (Command::QUOTE_SINGLE );
170
170
$ command ->addOption ('-d ' , $ argument );
171
- $ this ->assertEquals ($ expected , $ command ->build ());
171
+ $ this ->assertSame ($ expected , $ command ->build ());
172
172
173
173
$ argument = <<<ARG
174
174
x=test"2
@@ -179,7 +179,7 @@ public function testBuildEscapeArguments(): void
179
179
$ command = $ this ->getNewCommand ();
180
180
$ command ->setQuoteCharacter (Command::QUOTE_SINGLE );
181
181
$ command ->addOption ('-d ' , $ argument );
182
- $ this ->assertEquals ($ expected , $ command ->build ());
182
+ $ this ->assertSame ($ expected , $ command ->build ());
183
183
184
184
$ argument = <<<ARG
185
185
x=test'1"2
@@ -190,7 +190,7 @@ public function testBuildEscapeArguments(): void
190
190
$ command = $ this ->getNewCommand ();
191
191
$ command ->setQuoteCharacter (Command::QUOTE_SINGLE );
192
192
$ command ->addOption ('-d ' , $ argument );
193
- $ this ->assertEquals ($ expected , $ command ->build ());
193
+ $ this ->assertSame ($ expected , $ command ->build ());
194
194
195
195
$ argument = <<<ARG
196
196
x=test'1
@@ -201,7 +201,7 @@ public function testBuildEscapeArguments(): void
201
201
$ command = $ this ->getNewCommand ();
202
202
$ command ->setQuoteCharacter (Command::QUOTE_DOUBLE );
203
203
$ command ->addOption ('-d ' , $ argument );
204
- $ this ->assertEquals ($ expected , $ command ->build ());
204
+ $ this ->assertSame ($ expected , $ command ->build ());
205
205
206
206
$ argument = <<<ARG
207
207
x=test"2
@@ -212,7 +212,7 @@ public function testBuildEscapeArguments(): void
212
212
$ command = $ this ->getNewCommand ();
213
213
$ command ->setQuoteCharacter (Command::QUOTE_DOUBLE );
214
214
$ command ->addOption ('-d ' , $ argument );
215
- $ this ->assertEquals ($ expected , $ command ->build ());
215
+ $ this ->assertSame ($ expected , $ command ->build ());
216
216
217
217
$ argument = <<<ARG
218
218
x=test'1"2
@@ -223,15 +223,15 @@ public function testBuildEscapeArguments(): void
223
223
$ command = $ this ->getNewCommand ();
224
224
$ command ->setQuoteCharacter (Command::QUOTE_DOUBLE );
225
225
$ command ->addOption ('-d ' , $ argument );
226
- $ this ->assertEquals ($ expected , $ command ->build ());
226
+ $ this ->assertSame ($ expected , $ command ->build ());
227
227
}
228
228
229
229
public function testBuildMultipleOptions (): void
230
230
{
231
231
$ command = $ this ->getNewCommand ();
232
232
$ command ->addOption ('-H ' , 'Connection: keep-alive ' );
233
233
$ command ->addOption ('-H ' , 'Cache-Control: max-age=0 ' );
234
- $ this ->assertEquals ("curl -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' http://example.com " , $ command ->build ());
234
+ $ this ->assertSame ("curl -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' http://example.com " , $ command ->build ());
235
235
}
236
236
237
237
public function testBuildAddOptions (): void
@@ -242,15 +242,15 @@ public function testBuildAddOptions(): void
242
242
'-L ' ,
243
243
'-d ' => 'test '
244
244
]);
245
- $ this ->assertEquals ("curl -v -L -d 'test' http://example.com " , $ command ->build ());
245
+ $ this ->assertSame ("curl -v -L -d 'test' http://example.com " , $ command ->build ());
246
246
}
247
247
248
248
public function testBuildPsrHttpRequest (): void
249
249
{
250
250
$ request = new Request ('GET ' , 'http://example.com ' );
251
251
$ command = new Command ();
252
252
$ command ->setRequest ($ request );
253
- $ this ->assertEquals ('curl http://example.com ' , $ command ->build ());
253
+ $ this ->assertSame ('curl http://example.com ' , $ command ->build ());
254
254
255
255
$ request = new Request ('POST ' , 'http://example.com ' , [
256
256
'Connection ' => ['keep-alive ' ],
@@ -262,13 +262,13 @@ public function testBuildPsrHttpRequest(): void
262
262
263
263
$ command = new Command ();
264
264
$ command ->setRequest ($ request );
265
- $ this ->assertEquals ("curl -H 'Connection: keep-alive' -H 'Accept: text/html, application/xhtml+xml' -d 'data' http://example.com " , $ command ->build ());
265
+ $ this ->assertSame ("curl -H 'Connection: keep-alive' -H 'Accept: text/html, application/xhtml+xml' -d 'data' http://example.com " , $ command ->build ());
266
266
267
267
$ command = new Command ();
268
268
$ command ->setRequest ($ request , false );
269
- $ this ->assertEquals ('curl ' , $ command ->build ());
269
+ $ this ->assertSame ('curl ' , $ command ->build ());
270
270
$ command ->parseRequest ();
271
- $ this ->assertEquals ("curl -H 'Connection: keep-alive' -H 'Accept: text/html, application/xhtml+xml' -d 'data' http://example.com " , $ command ->build ());
271
+ $ this ->assertSame ("curl -H 'Connection: keep-alive' -H 'Accept: text/html, application/xhtml+xml' -d 'data' http://example.com " , $ command ->build ());
272
272
}
273
273
274
274
public function testBuildPsrHttpRequestHeaderExceptions (): void
@@ -282,7 +282,7 @@ public function testBuildPsrHttpRequestHeaderExceptions(): void
282
282
283
283
$ command = new Command ();
284
284
$ command ->setRequest ($ request );
285
- $ this ->assertEquals ("curl -H 'Set-Cookie: test1=1; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly' -H 'Set-Cookie: test2=2; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly' http://example.com " , $ command ->build ());
285
+ $ this ->assertSame ("curl -H 'Set-Cookie: test1=1; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly' -H 'Set-Cookie: test2=2; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly' http://example.com " , $ command ->build ());
286
286
}
287
287
288
288
public function testBuildParseRequest (): void
0 commit comments