liip / liip/LiipFunctionalTestBundle

Allow passing server parameters on form submit

Open
#405 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
PHP
Stars
648
Forks
179
PR merge metrics
No merged PRs in 30d

Description

When you do something like this:

```php
$form = $crawler->selectButton('Submit')->form();
$crawler = $client->submit($form, [
'foo' => 'bar',
]);
```

You can't pass any server value. But it can be useful, for example, to passe XHR header: https://stackoverflow.com/a/9505494/1731473

Current possible workaround:

```php
$crawler = $client->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $form->getPhpFiles(), [
'HTTP_X-Requested-With' => 'XMLHttpRequest',
]);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the client submit API and comparing it with the request workaround shown in the issue, including getMethod(), getUri(), getPhpValues(), getPhpFiles(), and server parameters. Done means submit accepts server values such as HTTP_X-Requested-With and forwards them while preserving the existing form data behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.