[BroserKit] Enable passthrew header information on submit
This enables browser Testingtools like mink to pass headerfiles while doing a form submmit
This commit is contained in:
parent
368a0c34b8
commit
fa2063efe4
@ -289,11 +289,11 @@ abstract class Client
|
||||
*
|
||||
* @return Crawler
|
||||
*/
|
||||
public function submit(Form $form, array $values = array())
|
||||
public function submit(Form $form, array $values = array(), $serverParameters = array())
|
||||
{
|
||||
$form->setValues($values);
|
||||
|
||||
return $this->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $form->getPhpFiles());
|
||||
return $this->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $form->getPhpFiles(), $serverParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -367,6 +367,20 @@ class ClientTest extends TestCase
|
||||
$this->assertEquals('bar', $server['PHP_AUTH_PW']);
|
||||
}
|
||||
|
||||
public function testSubmitPassthrewHeaders()
|
||||
{
|
||||
$client = new TestClient();
|
||||
$client->setNextResponse(new Response('<html><form action="/foo"><input type="submit" /></form></html>'));
|
||||
$crawler = $client->request('GET', 'http://www.example.com/foo/foobar');
|
||||
$headers = array('Accept-Language' => 'de');
|
||||
|
||||
$client->submit($crawler->filter('input')->form(), array(), $headers);
|
||||
|
||||
$server = $client->getRequest()->getServer();
|
||||
$this->assertArrayHasKey('Accept-Language', $server);
|
||||
$this->assertEquals('de', $server['Accept-Language']);
|
||||
}
|
||||
|
||||
public function testFollowRedirect()
|
||||
{
|
||||
$client = new TestClient();
|
||||
|
Reference in New Issue
Block a user