@@ -106,15 +106,15 @@ public function testGetExpiresTime()
106
106
{
107
107
$ cookie = Cookie::create ('foo ' , 'bar ' );
108
108
109
- $ this ->assertEquals (0 , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the default expire date ' );
109
+ $ this ->assertSame (0 , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the default expire date ' );
110
110
111
111
$ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = time () + 3600 );
112
112
113
- $ this ->assertEquals ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
113
+ $ this ->assertSame ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
114
114
115
115
$ cookie = Cookie::create ('foo ' )->withExpires ($ expire = time () + 3600 );
116
116
117
- $ this ->assertEquals ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
117
+ $ this ->assertSame ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
118
118
}
119
119
120
120
public function testConstructorWithDateTime ()
@@ -158,11 +158,11 @@ public function testGetDomain()
158
158
{
159
159
$ cookie = Cookie::create ('foo ' , 'bar ' , 0 , '/ ' , '.myfoodomain.com ' );
160
160
161
- $ this ->assertEquals ('.myfoodomain.com ' , $ cookie ->getDomain (), '->getDomain() returns the domain name on which the cookie is valid ' );
161
+ $ this ->assertSame ('.myfoodomain.com ' , $ cookie ->getDomain (), '->getDomain() returns the domain name on which the cookie is valid ' );
162
162
163
163
$ cookie = Cookie::create ('foo ' )->withDomain ('.mybardomain.com ' );
164
164
165
- $ this ->assertEquals ('.mybardomain.com ' , $ cookie ->getDomain (), '->getDomain() returns the domain name on which the cookie is valid ' );
165
+ $ this ->assertSame ('.mybardomain.com ' , $ cookie ->getDomain (), '->getDomain() returns the domain name on which the cookie is valid ' );
166
166
}
167
167
168
168
public function testIsSecure ()
@@ -191,7 +191,7 @@ public function testIsPartitioned()
191
191
{
192
192
$ cookie = Cookie::create ('foo ' , 'bar ' , 0 , '/ ' , '.myfoodomain.com ' , true , true ,false , 'Lax ' , true );
193
193
194
- $ this ->assertTrue ($ cookie ->isPartitioned (), );
194
+ $ this ->assertTrue ($ cookie ->isPartitioned ());
195
195
196
196
$ cookie = Cookie::create ('foo ' )->withPartitioned (true );
197
197
@@ -240,42 +240,42 @@ public function testToString()
240
240
{
241
241
$ expected = 'foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
242
242
$ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , false , null );
243
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of the cookie ' );
243
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() returns string representation of the cookie ' );
244
244
245
245
$ cookie = Cookie::create ('foo ' )
246
246
->withValue ('bar ' )
247
247
->withExpires (strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ))
248
248
->withDomain ('.myfoodomain.com ' )
249
249
->withSecure (true )
250
250
->withSameSite (null );
251
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of the cookie ' );
251
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() returns string representation of the cookie ' );
252
252
253
253
$ expected = 'foo=bar%20with%20white%20spaces; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
254
254
$ cookie = Cookie::create ('foo ' , 'bar with white spaces ' , strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , false , null );
255
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20) ' );
255
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20) ' );
256
256
257
257
$ cookie = Cookie::create ('foo ' )
258
258
->withValue ('bar with white spaces ' )
259
259
->withExpires (strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ))
260
260
->withDomain ('.myfoodomain.com ' )
261
261
->withSecure (true )
262
262
->withSameSite (null );
263
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20) ' );
263
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20) ' );
264
264
265
265
$ expected = 'foo=deleted; expires= ' .gmdate ('D, d M Y H:i:s T ' , $ expire = time () - 31536001 ).'; Max-Age=0; path=/admin/; domain=.myfoodomain.com; httponly ' ;
266
266
$ cookie = Cookie::create ('foo ' , null , 1 , '/admin/ ' , '.myfoodomain.com ' , false , true , false , null );
267
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
267
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
268
268
269
269
$ cookie = Cookie::create ('foo ' )
270
270
->withExpires (1 )
271
271
->withPath ('/admin/ ' )
272
272
->withDomain ('.myfoodomain.com ' )
273
273
->withSameSite (null );
274
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
274
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
275
275
276
276
$ expected = 'foo=deleted; expires= ' .gmdate ('D, d M Y H:i:s T ' , $ expire = time () - 31536001 ).'; Max-Age=0; path=/admin/; domain=.myfoodomain.com; secure; httponly; samesite=none; partitioned ' ;
277
277
$ cookie = Cookie::create ('foo ' , null , 1 , '/admin/ ' , '.myfoodomain.com ' , true , true , false , 'none ' , true );
278
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
278
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
279
279
280
280
$ cookie = Cookie::create ('foo ' )
281
281
->withExpires (1 )
@@ -285,49 +285,49 @@ public function testToString()
285
285
->withHttpOnly (true )
286
286
->withSameSite ('none ' )
287
287
->withPartitioned (true );
288
- $ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
288
+ $ this ->assertSame ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
289
289
290
290
$ expected = 'foo=bar; path=/; httponly; samesite=lax ' ;
291
291
$ cookie = Cookie::create ('foo ' , 'bar ' );
292
- $ this ->assertEquals ($ expected , (string ) $ cookie );
292
+ $ this ->assertSame ($ expected , (string ) $ cookie );
293
293
294
294
$ cookie = Cookie::create ('foo ' )->withValue ('bar ' );
295
- $ this ->assertEquals ($ expected , (string ) $ cookie );
295
+ $ this ->assertSame ($ expected , (string ) $ cookie );
296
296
}
297
297
298
298
public function testRawCookie ()
299
299
{
300
300
$ cookie = Cookie::create ('foo ' , 'b a r ' , 0 , '/ ' , null , false , false , false , null );
301
301
$ this ->assertFalse ($ cookie ->isRaw ());
302
- $ this ->assertEquals ('foo=b%20a%20r; path=/ ' , (string ) $ cookie );
302
+ $ this ->assertSame ('foo=b%20a%20r; path=/ ' , (string ) $ cookie );
303
303
304
304
$ cookie = Cookie::create ('test ' )->withValue ('t e s t ' )->withHttpOnly (false )->withSameSite (null );
305
305
$ this ->assertFalse ($ cookie ->isRaw ());
306
- $ this ->assertEquals ('test=t%20e%20s%20t; path=/ ' , (string ) $ cookie );
306
+ $ this ->assertSame ('test=t%20e%20s%20t; path=/ ' , (string ) $ cookie );
307
307
308
308
$ cookie = Cookie::create ('foo ' , 'b+a+r ' , 0 , '/ ' , null , false , false , true , null );
309
309
$ this ->assertTrue ($ cookie ->isRaw ());
310
- $ this ->assertEquals ('foo=b+a+r; path=/ ' , (string ) $ cookie );
310
+ $ this ->assertSame ('foo=b+a+r; path=/ ' , (string ) $ cookie );
311
311
312
312
$ cookie = Cookie::create ('foo ' )
313
313
->withValue ('t+e+s+t ' )
314
314
->withHttpOnly (false )
315
315
->withRaw (true )
316
316
->withSameSite (null );
317
317
$ this ->assertTrue ($ cookie ->isRaw ());
318
- $ this ->assertEquals ('foo=t+e+s+t; path=/ ' , (string ) $ cookie );
318
+ $ this ->assertSame ('foo=t+e+s+t; path=/ ' , (string ) $ cookie );
319
319
}
320
320
321
321
public function testGetMaxAge ()
322
322
{
323
323
$ cookie = Cookie::create ('foo ' , 'bar ' );
324
- $ this ->assertEquals (0 , $ cookie ->getMaxAge ());
324
+ $ this ->assertSame (0 , $ cookie ->getMaxAge ());
325
325
326
326
$ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = time () + 100 );
327
- $ this ->assertEquals ($ expire - time (), $ cookie ->getMaxAge ());
327
+ $ this ->assertSame ($ expire - time (), $ cookie ->getMaxAge ());
328
328
329
329
$ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = time () - 100 );
330
- $ this ->assertEquals (0 , $ cookie ->getMaxAge ());
330
+ $ this ->assertSame (0 , $ cookie ->getMaxAge ());
331
331
}
332
332
333
333
public function testFromString ()
@@ -363,13 +363,13 @@ public function testFromStringWithHttpOnly()
363
363
public function testSameSiteAttribute ()
364
364
{
365
365
$ cookie = new Cookie ('foo ' , 'bar ' , 0 , '/ ' , null , false , true , false , 'Lax ' );
366
- $ this ->assertEquals ('lax ' , $ cookie ->getSameSite ());
366
+ $ this ->assertSame ('lax ' , $ cookie ->getSameSite ());
367
367
368
368
$ cookie = new Cookie ('foo ' , 'bar ' , 0 , '/ ' , null , false , true , false , '' );
369
369
$ this ->assertNull ($ cookie ->getSameSite ());
370
370
371
371
$ cookie = Cookie::create ('foo ' )->withSameSite ('Lax ' );
372
- $ this ->assertEquals ('lax ' , $ cookie ->getSameSite ());
372
+ $ this ->assertSame ('lax ' , $ cookie ->getSameSite ());
373
373
}
374
374
375
375
public function testSetSecureDefault ()
@@ -392,27 +392,27 @@ public function testMaxAge()
392
392
$ futureDateOneHour = gmdate ('D, d M Y H:i:s T ' , time () + 3600 );
393
393
394
394
$ cookie = Cookie::fromString ('foo=bar; Max-Age=3600; path=/ ' );
395
- $ this ->assertEquals ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
395
+ $ this ->assertSame ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
396
396
397
397
$ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' );
398
- $ this ->assertEquals ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
398
+ $ this ->assertSame ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
399
399
400
400
$ futureDateHalfHour = gmdate ('D, d M Y H:i:s T ' , time () + 1800 );
401
401
402
402
// Max-Age value takes precedence before expires
403
403
$ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDateHalfHour .'; Max-Age=3600; path=/ ' );
404
- $ this ->assertEquals ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
404
+ $ this ->assertSame ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
405
405
}
406
406
407
407
public function testExpiredWithMaxAge ()
408
408
{
409
409
$ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/ ' );
410
- $ this ->assertEquals ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/ ' , $ cookie ->__toString ());
410
+ $ this ->assertSame ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/ ' , $ cookie ->__toString ());
411
411
412
412
$ futureDate = gmdate ('D, d-M-Y H:i:s T ' , time () + 864000 );
413
413
414
414
$ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDate .'; Max-Age=0; path=/ ' );
415
- $ this ->assertEquals (time (), $ cookie ->getExpiresTime ());
416
- $ this ->assertEquals ('foo=bar; expires= ' .gmdate ('D, d M Y H:i:s T ' , $ cookie ->getExpiresTime ()).'; Max-Age=0; path=/ ' , $ cookie ->__toString ());
415
+ $ this ->assertSame (time (), $ cookie ->getExpiresTime ());
416
+ $ this ->assertSame ('foo=bar; expires= ' .gmdate ('D, d M Y H:i:s T ' , $ cookie ->getExpiresTime ()).'; Max-Age=0; path=/ ' , $ cookie ->__toString ());
417
417
}
418
418
}
0 commit comments