[ticket/17176] Work around bug with fileuploads in BrowserKit

PHPBB3-17176
This commit is contained in:
Marc Alexander 2023-08-19 13:05:57 +02:00
parent 2d7c668a28
commit 549c818a5c
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -164,6 +164,16 @@ class phpbb_functional_test_case extends phpbb_test_case
*/
static public function submit(Symfony\Component\DomCrawler\Form $form, array $values = array(), $assert_response_html = true)
{
// Remove files from form if no file was submitted
// See: https://github.com/symfony/symfony/issues/49014
foreach ($form->getFiles() as $field_name => $value)
{
if (!$value['name'] && !$value['tmp_name'])
{
$form->remove($field_name);
}
}
$crawler = self::$client->submit($form, $values);
if ($assert_response_html)