Esempio n. 1
0
 public function testHoldsValues()
 {
     $t = time();
     $data = array('Name' => 'foo', 'Value' => 'baz', 'Path' => '/bar', 'Domain' => 'baz.com', 'Expires' => $t, 'Max-Age' => 100, 'Secure' => true, 'Discard' => true, 'HttpOnly' => true, 'foo' => 'baz', 'bar' => 'bam');
     $cookie = new SetCookie($data);
     $this->assertEquals($data, $cookie->toArray());
     $this->assertEquals('foo', $cookie->getName());
     $this->assertEquals('baz', $cookie->getValue());
     $this->assertEquals('baz.com', $cookie->getDomain());
     $this->assertEquals('/bar', $cookie->getPath());
     $this->assertEquals($t, $cookie->getExpires());
     $this->assertEquals(100, $cookie->getMaxAge());
     $this->assertTrue($cookie->getSecure());
     $this->assertTrue($cookie->getDiscard());
     $this->assertTrue($cookie->getHttpOnly());
     $this->assertEquals('baz', $cookie->toArray()['foo']);
     $this->assertEquals('bam', $cookie->toArray()['bar']);
     $cookie->setName('a')->setValue('b')->setPath('c')->setDomain('bar.com')->setExpires(10)->setMaxAge(200)->setSecure(false)->setHttpOnly(false)->setDiscard(false);
     $this->assertEquals('a', $cookie->getName());
     $this->assertEquals('b', $cookie->getValue());
     $this->assertEquals('c', $cookie->getPath());
     $this->assertEquals('bar.com', $cookie->getDomain());
     $this->assertEquals(10, $cookie->getExpires());
     $this->assertEquals(200, $cookie->getMaxAge());
     $this->assertFalse($cookie->getSecure());
     $this->assertFalse($cookie->getDiscard());
     $this->assertFalse($cookie->getHttpOnly());
 }