@@ -106,15 +106,15 @@ public function testGetExpiresTime()
106106 {
107107 $ cookie = Cookie::create ('foo ' , 'bar ' );
108108
109- $ this ->assertEquals (0 , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the default expire date ' );
109+ $ this ->assertSame (0 , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the default expire date ' );
110110
111111 $ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = time () + 3600 );
112112
113- $ this ->assertEquals ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
113+ $ this ->assertSame ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
114114
115115 $ cookie = Cookie::create ('foo ' )->withExpires ($ expire = time () + 3600 );
116116
117- $ this ->assertEquals ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
117+ $ this ->assertSame ($ expire , $ cookie ->getExpiresTime (), '->getExpiresTime() returns the expire date ' );
118118 }
119119
120120 public function testConstructorWithDateTime ()
@@ -158,11 +158,11 @@ public function testGetDomain()
158158 {
159159 $ cookie = Cookie::create ('foo ' , 'bar ' , 0 , '/ ' , '.myfoodomain.com ' );
160160
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 ' );
162162
163163 $ cookie = Cookie::create ('foo ' )->withDomain ('.mybardomain.com ' );
164164
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 ' );
166166 }
167167
168168 public function testIsSecure ()
@@ -191,7 +191,7 @@ public function testIsPartitioned()
191191 {
192192 $ cookie = Cookie::create ('foo ' , 'bar ' , 0 , '/ ' , '.myfoodomain.com ' , true , true ,false , 'Lax ' , true );
193193
194- $ this ->assertTrue ($ cookie ->isPartitioned (), );
194+ $ this ->assertTrue ($ cookie ->isPartitioned ());
195195
196196 $ cookie = Cookie::create ('foo ' )->withPartitioned (true );
197197
@@ -240,42 +240,42 @@ public function testToString()
240240 {
241241 $ expected = 'foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
242242 $ 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 ' );
244244
245245 $ cookie = Cookie::create ('foo ' )
246246 ->withValue ('bar ' )
247247 ->withExpires (strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ))
248248 ->withDomain ('.myfoodomain.com ' )
249249 ->withSecure (true )
250250 ->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 ' );
252252
253253 $ expected = 'foo=bar%20with%20white%20spaces; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
254254 $ 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) ' );
256256
257257 $ cookie = Cookie::create ('foo ' )
258258 ->withValue ('bar with white spaces ' )
259259 ->withExpires (strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ))
260260 ->withDomain ('.myfoodomain.com ' )
261261 ->withSecure (true )
262262 ->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) ' );
264264
265265 $ 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 ' ;
266266 $ 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 ' );
268268
269269 $ cookie = Cookie::create ('foo ' )
270270 ->withExpires (1 )
271271 ->withPath ('/admin/ ' )
272272 ->withDomain ('.myfoodomain.com ' )
273273 ->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 ' );
275275
276276 $ 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 ' ;
277277 $ 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 ' );
279279
280280 $ cookie = Cookie::create ('foo ' )
281281 ->withExpires (1 )
@@ -285,49 +285,49 @@ public function testToString()
285285 ->withHttpOnly (true )
286286 ->withSameSite ('none ' )
287287 ->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 ' );
289289
290290 $ expected = 'foo=bar; path=/; httponly; samesite=lax ' ;
291291 $ cookie = Cookie::create ('foo ' , 'bar ' );
292- $ this ->assertEquals ($ expected , (string ) $ cookie );
292+ $ this ->assertSame ($ expected , (string ) $ cookie );
293293
294294 $ cookie = Cookie::create ('foo ' )->withValue ('bar ' );
295- $ this ->assertEquals ($ expected , (string ) $ cookie );
295+ $ this ->assertSame ($ expected , (string ) $ cookie );
296296 }
297297
298298 public function testRawCookie ()
299299 {
300300 $ cookie = Cookie::create ('foo ' , 'b a r ' , 0 , '/ ' , null , false , false , false , null );
301301 $ this ->assertFalse ($ cookie ->isRaw ());
302- $ this ->assertEquals ('foo=b%20a%20r; path=/ ' , (string ) $ cookie );
302+ $ this ->assertSame ('foo=b%20a%20r; path=/ ' , (string ) $ cookie );
303303
304304 $ cookie = Cookie::create ('test ' )->withValue ('t e s t ' )->withHttpOnly (false )->withSameSite (null );
305305 $ 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 );
307307
308308 $ cookie = Cookie::create ('foo ' , 'b+a+r ' , 0 , '/ ' , null , false , false , true , null );
309309 $ this ->assertTrue ($ cookie ->isRaw ());
310- $ this ->assertEquals ('foo=b+a+r; path=/ ' , (string ) $ cookie );
310+ $ this ->assertSame ('foo=b+a+r; path=/ ' , (string ) $ cookie );
311311
312312 $ cookie = Cookie::create ('foo ' )
313313 ->withValue ('t+e+s+t ' )
314314 ->withHttpOnly (false )
315315 ->withRaw (true )
316316 ->withSameSite (null );
317317 $ 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 );
319319 }
320320
321321 public function testGetMaxAge ()
322322 {
323323 $ cookie = Cookie::create ('foo ' , 'bar ' );
324- $ this ->assertEquals (0 , $ cookie ->getMaxAge ());
324+ $ this ->assertSame (0 , $ cookie ->getMaxAge ());
325325
326326 $ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = time () + 100 );
327- $ this ->assertEquals ($ expire - time (), $ cookie ->getMaxAge ());
327+ $ this ->assertSame ($ expire - time (), $ cookie ->getMaxAge ());
328328
329329 $ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = time () - 100 );
330- $ this ->assertEquals (0 , $ cookie ->getMaxAge ());
330+ $ this ->assertSame (0 , $ cookie ->getMaxAge ());
331331 }
332332
333333 public function testFromString ()
@@ -363,13 +363,13 @@ public function testFromStringWithHttpOnly()
363363 public function testSameSiteAttribute ()
364364 {
365365 $ cookie = new Cookie ('foo ' , 'bar ' , 0 , '/ ' , null , false , true , false , 'Lax ' );
366- $ this ->assertEquals ('lax ' , $ cookie ->getSameSite ());
366+ $ this ->assertSame ('lax ' , $ cookie ->getSameSite ());
367367
368368 $ cookie = new Cookie ('foo ' , 'bar ' , 0 , '/ ' , null , false , true , false , '' );
369369 $ this ->assertNull ($ cookie ->getSameSite ());
370370
371371 $ cookie = Cookie::create ('foo ' )->withSameSite ('Lax ' );
372- $ this ->assertEquals ('lax ' , $ cookie ->getSameSite ());
372+ $ this ->assertSame ('lax ' , $ cookie ->getSameSite ());
373373 }
374374
375375 public function testSetSecureDefault ()
@@ -392,27 +392,27 @@ public function testMaxAge()
392392 $ futureDateOneHour = gmdate ('D, d M Y H:i:s T ' , time () + 3600 );
393393
394394 $ 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 ());
396396
397397 $ 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 ());
399399
400400 $ futureDateHalfHour = gmdate ('D, d M Y H:i:s T ' , time () + 1800 );
401401
402402 // Max-Age value takes precedence before expires
403403 $ 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 ());
405405 }
406406
407407 public function testExpiredWithMaxAge ()
408408 {
409409 $ 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 ());
411411
412412 $ futureDate = gmdate ('D, d-M-Y H:i:s T ' , time () + 864000 );
413413
414414 $ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDate .'; Max-Age=0; path=/ ' );
4D24
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 ());
417417 }
418418}
0 commit comments