@@ -227,31 +227,31 @@ public function testCookieIsCleared()
227
227
228
228
public function testToString ()
229
229
{
230
- $ expected = 'foo=bar; expires=Fri, 20- May- 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
231
- $ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = strtotime ('Fri, 20- May- 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , false , null );
230
+ $ expected = 'foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
231
+ $ cookie = Cookie::create ('foo ' , 'bar ' , $ expire = strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , false , null );
232
232
$ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of the cookie ' );
233
233
234
234
$ cookie = Cookie::create ('foo ' )
235
235
->withValue ('bar ' )
236
- ->withExpires (strtotime ('Fri, 20- May- 2011 15:25:52 GMT ' ))
236
+ ->withExpires (strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ))
237
237
->withDomain ('.myfoodomain.com ' )
238
238
->withSecure (true )
239
239
->withSameSite (null );
240
240
$ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of the cookie ' );
241
241
242
- $ expected = 'foo=bar%20with%20white%20spaces; expires=Fri, 20- May- 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
243
- $ cookie = Cookie::create ('foo ' , 'bar with white spaces ' , strtotime ('Fri, 20- May- 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , false , null );
242
+ $ expected = 'foo=bar%20with%20white%20spaces; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly ' ;
243
+ $ cookie = Cookie::create ('foo ' , 'bar with white spaces ' , strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , false , null );
244
244
$ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20) ' );
245
245
246
246
$ cookie = Cookie::create ('foo ' )
247
247
->withValue ('bar with white spaces ' )
248
- ->withExpires (strtotime ('Fri, 20- May- 2011 15:25:52 GMT ' ))
248
+ ->withExpires (strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ))
249
249
->withDomain ('.myfoodomain.com ' )
250
250
->withSecure (true )
251
251
->withSameSite (null );
252
252
$ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20) ' );
253
253
254
- $ 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 ' ;
254
+ $ 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 ' ;
255
255
$ cookie = Cookie::create ('foo ' , null , 1 , '/admin/ ' , '.myfoodomain.com ' , false , true , false , null );
256
256
$ this ->assertEquals ($ expected , (string ) $ cookie , '->__toString() returns string representation of a cleared cookie if value is NULL ' );
257
257
@@ -307,28 +307,28 @@ public function testGetMaxAge()
307
307
308
308
public function testFromString ()
309
309
{
310
- $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20- May- 2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly ' );
311
- $ this ->assertEquals (Cookie::create ('foo ' , 'bar ' , strtotime ('Fri, 20- May- 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , true , null ), $ cookie );
310
+ $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly ' );
311
+ $ this ->assertEquals (Cookie::create ('foo ' , 'bar ' , strtotime ('Fri, 20 May 2011 15:25:52 GMT ' ), '/ ' , '.myfoodomain.com ' , true , true , true , null ), $ cookie );
312
312
313
313
$ cookie = Cookie::fromString ('foo=bar ' , true );
314
314
$ this ->assertEquals (Cookie::create ('foo ' , 'bar ' , 0 , '/ ' , null , false , false , false , null ), $ cookie );
315
315
316
316
$ cookie = Cookie::fromString ('foo ' , true );
317
317
$ this ->assertEquals (Cookie::create ('foo ' , null , 0 , '/ ' , null , false , false , false , null ), $ cookie );
318
318
319
- $ cookie = Cookie::fromString ('foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22- Sep- 2020 06:27:09 GMT; path=/ ' );
320
- $ this ->assertEquals (Cookie::create ('foo_cookie ' , 'foo=1&bar=2&baz=3 ' , strtotime ('Tue, 22- Sep- 2020 06:27:09 GMT ' ), '/ ' , null , false , false , true , null ), $ cookie );
319
+ $ cookie = Cookie::fromString ('foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22 Sep 2020 06:27:09 GMT; path=/ ' );
320
+ $ this ->assertEquals (Cookie::create ('foo_cookie ' , 'foo=1&bar=2&baz=3 ' , strtotime ('Tue, 22 Sep 2020 06:27:09 GMT ' ), '/ ' , null , false , false , true , null ), $ cookie );
321
321
322
- $ cookie = Cookie::fromString ('foo_cookie=foo==; expires=Tue, 22- Sep- 2020 06:27:09 GMT; path=/ ' );
323
- $ this ->assertEquals (Cookie::create ('foo_cookie ' , 'foo== ' , strtotime ('Tue, 22- Sep- 2020 06:27:09 GMT ' ), '/ ' , null , false , false , true , null ), $ cookie );
322
+ $ cookie = Cookie::fromString ('foo_cookie=foo==; expires=Tue, 22 Sep 2020 06:27:09 GMT; path=/ ' );
323
+ $ this ->assertEquals (Cookie::create ('foo_cookie ' , 'foo== ' , strtotime ('Tue, 22 Sep 2020 06:27:09 GMT ' ), '/ ' , null , false , false , true , null ), $ cookie );
324
324
}
325
325
326
326
public function testFromStringWithHttpOnly ()
327
327
{
328
- $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20- May- 2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly ' );
328
+ $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly ' );
329
329
$ this ->assertTrue ($ cookie ->isHttpOnly ());
330
330
331
- $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20- May- 2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure ' );
331
+ $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure ' );
332
332
$ this ->assertFalse ($ cookie ->isHttpOnly ());
333
333
}
334
334
@@ -361,15 +361,15 @@ public function testSetSecureDefault()
361
361
362
362
public function testMaxAge ()
363
363
{
364
- $ futureDateOneHour = gmdate ('D, d-M- Y H:i:s T ' , time () + 3600 );
364
+ $ futureDateOneHour = gmdate ('D, d M Y H:i:s T ' , time () + 3600 );
365
365
366
366
$ cookie = Cookie::fromString ('foo=bar; Max-Age=3600; path=/ ' );
367
367
$ this ->assertEquals ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
368
368
369
369
$ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' );
370
370
$ this ->assertEquals ('foo=bar; expires= ' .$ futureDateOneHour .'; Max-Age=3600; path=/ ' , $ cookie ->__toString ());
371
371
372
- $ futureDateHalfHour = gmdate ('D, d-M- Y H:i:s T ' , time () + 1800 );
372
+ $ futureDateHalfHour = gmdate ('D, d M Y H:i:s T ' , time () + 1800 );
373
373
374
374
// Max-Age value takes precedence before expires
375
375
$ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDateHalfHour .'; Max-Age=3600; path=/ ' );
@@ -378,13 +378,13 @@ public function testMaxAge()
378
378
379
379
public function testExpiredWithMaxAge ()
380
380
{
381
- $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20- May- 2011 15:25:52 GMT; Max-Age=0; path=/ ' );
382
- $ this ->assertEquals ('foo=bar; expires=Fri, 20- May- 2011 15:25:52 GMT; Max-Age=0; path=/ ' , $ cookie ->__toString ());
381
+ $ cookie = Cookie::fromString ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/ ' );
382
+ $ this ->assertEquals ('foo=bar; expires=Fri, 20 May 2011 15:25:52 GMT; Max-Age=0; path=/ ' , $ cookie ->__toString ());
383
383
384
384
$ futureDate = gmdate ('D, d-M-Y H:i:s T ' , time () + 864000 );
385
385
386
386
$ cookie = Cookie::fromString ('foo=bar; expires= ' .$ futureDate .'; Max-Age=0; path=/ ' );
387
387
$ this ->assertEquals (time (), $ cookie ->getExpiresTime ());
388
- $ this ->assertEquals ('foo=bar; expires= ' .gmdate ('D, d-M- Y H:i:s T ' , $ cookie ->getExpiresTime ()).'; Max-Age=0; path=/ ' , $ cookie ->__toString ());
388
+ $ this ->assertEquals ('foo=bar; expires= ' .gmdate ('D, d M Y H:i:s T ' , $ cookie ->getExpiresTime ()).'; Max-Age=0; path=/ ' , $ cookie ->__toString ());
389
389
}
390
390
}
0 commit comments