|
16 | 16 | useSymfony\Component\BrowserKit\CookieJar; |
17 | 17 | useSymfony\Component\BrowserKit\History; |
18 | 18 | useSymfony\Component\BrowserKit\Response; |
| 19 | +useSymfony\Component\DomCrawler\FormasDomCrawlerForm; |
19 | 20 |
|
20 | 21 | class SpecialResponseextends Response |
21 | 22 | { |
@@ -877,4 +878,42 @@ public function testInternalRequestNull() |
877 | 878 | $client =newTestClient(); |
878 | 879 | $this->assertNull($client->getInternalRequest()); |
879 | 880 | } |
| 881 | + |
| 882 | +/** |
| 883 | + * @group legacy |
| 884 | + * @expectedDeprecation The "Symfony\Component\BrowserKit\Client::submit()" method will have a third `array $serverParameters = array()` argument in version 5.0 and higher.Not defining it is deprecated since Symfony 4.1. |
| 885 | + */ |
| 886 | +publicfunctiontestInheritedClassCallSubmitWithTwoArguments() |
| 887 | + { |
| 888 | +$clientChild =newClassThatInheritClient(); |
| 889 | +$clientChild->setNextResponse(newResponse('<html><form action="/foo"><input type="submit" /></form></html>')); |
| 890 | +$clientChild->submit($clientChild->request('GET','http://www.example.com/foo/foobar')->filter('input')->form()); |
| 891 | + } |
| 892 | +} |
| 893 | + |
| 894 | +class ClassThatInheritClientextends Client |
| 895 | +{ |
| 896 | +protected$nextResponse =null; |
| 897 | + |
| 898 | +publicfunctionsetNextResponse(Response$response) |
| 899 | + { |
| 900 | +$this->nextResponse =$response; |
| 901 | + } |
| 902 | + |
| 903 | +protectedfunctiondoRequest($request) |
| 904 | + { |
| 905 | +if (null ===$this->nextResponse) { |
| 906 | +returnnewResponse(); |
| 907 | + } |
| 908 | + |
| 909 | +$response =$this->nextResponse; |
| 910 | +$this->nextResponse =null; |
| 911 | + |
| 912 | +return$response; |
| 913 | + } |
| 914 | + |
| 915 | +publicfunctionsubmit(DomCrawlerForm$form,array$values =array()) |
| 916 | + { |
| 917 | +returnparent::submit($form,$values); |
| 918 | + } |
880 | 919 | } |