|
@@ -18,9 +18,9 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|
|
/**
|
|
|
* @dataProvider getTestsForToFromString
|
|
|
*/
|
|
|
- public function testToFromString($cookie)
|
|
|
+ public function testToFromString($cookie, $url = null)
|
|
|
{
|
|
|
- $this->assertEquals($cookie, (string) Cookie::fromString($cookie));
|
|
|
+ $this->assertEquals($cookie, (string) Cookie::fromString($cookie, $url));
|
|
|
}
|
|
|
|
|
|
public function getTestsForToFromString()
|
|
@@ -30,14 +30,20 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|
|
array('foo=bar; expires=Fri, 31-Dec-2010 23:59:59 GMT'),
|
|
|
array('foo=bar; path=/foo'),
|
|
|
array('foo=bar; domain=google.com'),
|
|
|
- array('foo=bar; secure'),
|
|
|
+ array('foo=bar; domain=example.com; secure', 'https://example.com/'),
|
|
|
array('foo=bar; httponly'),
|
|
|
- array('foo=bar; domain=google.com; path=/foo; secure; httponly'),
|
|
|
+ array('foo=bar; domain=google.com; path=/foo; secure; httponly', 'https://google.com/'),
|
|
|
array('foo=bar=baz'),
|
|
|
array('foo=bar%3Dbaz'),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ public function testFromStringIgnoreSecureFlag()
|
|
|
+ {
|
|
|
+ $this->assertFalse(Cookie::fromString('foo=bar; secure')->isSecure());
|
|
|
+ $this->assertFalse(Cookie::fromString('foo=bar; secure', 'http://example.com/')->isSecure());
|
|
|
+ }
|
|
|
+
|
|
|
public function testFromStringWithUrl()
|
|
|
{
|
|
|
$this->assertEquals('foo=bar; domain=www.example.com', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));
|