1212namespace Symfony \UX \LiveComponent \Test ;
1313
1414use Symfony \Bundle \FrameworkBundle \KernelBrowser ;
15+ use Symfony \Component \HttpFoundation \File \UploadedFile ;
1516use Symfony \Component \HttpFoundation \Response ;
1617use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
1718use Symfony \Component \Security \Core \User \UserInterface ;
@@ -76,11 +77,12 @@ public function actingAs(object $user, string $firewallContext = 'main'): self
7677 }
7778
7879 /**
79- * @param array<string,mixed> $arguments
80+ * @param array<string,mixed> $arguments
81+ * @param array<string, UploadedFile> $files
8082 */
81- public function call (string $ action , array $ arguments = []): self
83+ public function call (string $ action , array $ arguments = [], array $ files = [] ): self
8284 {
83- return $ this ->request (['args ' => $ arguments ], $ action );
85+ return $ this ->request (['args ' => $ arguments ], $ action, $ files );
8486 }
8587
8688 /**
@@ -123,7 +125,7 @@ public function response(): Response
123125 return $ this ->client ()->getResponse ();
124126 }
125127
126- private function request (array $ content = [], ?string $ action = null ): self
128+ private function request (array $ content = [], ?string $ action = null , array $ files = [] ): self
127129 {
128130 $ csrfToken = $ this ->csrfToken ();
129131
@@ -137,6 +139,7 @@ private function request(array $content = [], ?string $action = null): self
137139 ])
138140 ),
139141 parameters: ['data ' => json_encode (array_merge ($ content , ['props ' => $ this ->props ()]))],
142+ files: $ files ,
140143 server: $ csrfToken ? ['HTTP_X_CSRF_TOKEN ' => $ csrfToken ] : [],
141144 );
142145
0 commit comments