Beispiel #1
0
 public function test_build()
 {
     $builder = new CookieBuilder();
     $cookie = new Cookie('foo', 'bar');
     $cookie->setPath('/foo/bar');
     $cookie->setDomain('foo.bar');
     $cookie->setSecure(true);
     $cookie->setHttpOnly(true);
     $cookie->setMaxAge(60);
     $this->assertEquals(s('foo=bar; expires=%s; max-age=%s; path=/foo/bar; domain=foo.bar; secure; httpOnly', $cookie->getExpiresDate(), $cookie->getMaxAge()), $builder->build($cookie));
 }
Beispiel #2
0
 public function test_create_from_string()
 {
     $cookie = new Cookie('foo', 'bar');
     $cookie->setSecure(true);
     $cookie->setHttpOnly(true);
     $cookie->setMaxAge(time());
     $cookie->setDomain('google.com');
     $cookie->setPath('/foo/bar');
     $this->assertEquals($cookie->toArray(), Cookie::createFromString($cookie->toString())->toArray());
 }