[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:
Julien Menth 2018-04-04 13:28:36 +02:00
parent 368a0c34b8
commit fa2063efe4
2 changed files with 16 additions and 2 deletions

View File

@ -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);
}
/**

View File

@ -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();