improve BrowserKit test coverage p1
improve BrowserKit test coverage p2 improve BrowserKit test coverage p3 improve BrowserKit test coverage p4 improve BrowserKit test coverage p5
This commit is contained in:
parent
0c2f1d94de
commit
0261b48168
@ -624,4 +624,24 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertArrayHasKey('HTTPS', $server);
|
||||
$this->assertFalse($server['HTTPS']);
|
||||
}
|
||||
|
||||
public function testInternalRequest()
|
||||
{
|
||||
$client = new TestClient();
|
||||
|
||||
$client->request('GET', 'https://www.example.com/https/www.example.com', array(), array(), array(
|
||||
'HTTP_HOST' => 'testhost',
|
||||
'HTTP_USER_AGENT' => 'testua',
|
||||
'HTTPS' => false,
|
||||
'NEW_SERVER_KEY' => 'new-server-key-value',
|
||||
));
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\BrowserKit\Request', $client->getInternalRequest());
|
||||
}
|
||||
|
||||
public function testInternalRequestNull()
|
||||
{
|
||||
$client = new TestClient();
|
||||
$this->assertNull($client->getInternalRequest());
|
||||
}
|
||||
}
|
||||
|
@ -174,6 +174,16 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array(), array_keys($cookieJar->allValues('http://example.com/')));
|
||||
}
|
||||
|
||||
public function testCookieExpireWithDomain()
|
||||
{
|
||||
$cookieJar = new CookieJar();
|
||||
$cookieJar->set($cookie1 = new Cookie('foo', 'bar1', null, '/foo', 'http://example2.com/'));
|
||||
$cookieJar->expire('foo', '/foo', 'http://example2.com/');
|
||||
|
||||
$this->assertNull($cookieJar->get('foo'), '->get() returns null if the cookie is expired');
|
||||
$this->assertEquals(array(), array_keys($cookieJar->allValues('http://example2.com/')));
|
||||
}
|
||||
|
||||
public function testCookieWithSameNameButDifferentPaths()
|
||||
{
|
||||
$cookieJar = new CookieJar();
|
||||
@ -207,6 +217,14 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($cookie2, $cookieJar->get('foo1', '/', 'test.example.com'));
|
||||
}
|
||||
|
||||
public function testCookieGetWithWrongSubdomain()
|
||||
{
|
||||
$cookieJar = new CookieJar();
|
||||
$cookieJar->set($cookie1 = new Cookie('foo1', 'bar', null, '/', 'test.example.com'));
|
||||
|
||||
$this->assertNull($cookieJar->get('foo1', '/', 'foo.example.com'));
|
||||
}
|
||||
|
||||
public function testCookieGetWithSubdirectory()
|
||||
{
|
||||
$cookieJar = new CookieJar();
|
||||
|
@ -176,4 +176,13 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
||||
$cookie = new Cookie('foo', 'bar', 0);
|
||||
$this->assertFalse($cookie->isExpired());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException UnexpectedValueException
|
||||
* @expectedExceptionMessage The cookie expiration time "string" is not valid.
|
||||
*/
|
||||
public function testConstructException()
|
||||
{
|
||||
$cookie = new Cookie('foo', 'bar', 'string');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user