fixed typos

This commit is contained in:
Fabien Potencier 2010-06-28 08:31:22 +02:00
parent e578dfdbec
commit 1b9645b098
3 changed files with 9 additions and 11 deletions

View File

@ -65,14 +65,14 @@ class Cookie
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('UTC'))->format(static::DATE_FORMAT), 0, -5);
}
if ('/' !== $this->path) {
$cookie .= '; path='.$this->path;
}
if ('' !== $this->domain) {
$cookie .= '; domain='.$this->domain;
}
if ('/' !== $this->path) {
$cookie .= '; path='.$this->path;
}
if ($this->secure) {
$cookie .= '; secure';
}

View File

@ -204,7 +204,7 @@ class HeaderBag
} else {
$expires = strtotime($expires);
if (false === $expires || -1 == $expires) {
throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expire));
throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expires));
}
}
}
@ -213,14 +213,12 @@ class HeaderBag
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5);
}
$cookie .= '; domain='.$domain;
if ('/' !== $path) {
$cookie .= '; path='.$path;
}
if ('' !== $domain) {
$cookie .= '; domain='.$domain;
}
if ($secure) {
$cookie .= '; secure';
}

View File

@ -32,14 +32,14 @@ class CookieTest extends \PHPUnit_Framework_TestCase
array('foo=bar; domain=google.com'),
array('foo=bar; secure'),
array('foo=bar; httponly'),
array('foo=bar; path=/foo; domain=google.com; secure; httponly'),
array('foo=bar; domain=google.com; path=/foo; secure; httponly'),
);
}
public function testFromStringWithUrl()
{
$this->assertEquals('foo=bar; domain=www.example.com', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));
$this->assertEquals('foo=bar; path=/foo; domain=www.example.com', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
}
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()