|
16 | 16 | use Symfony\Component\BrowserKit\CookieJar; |
17 | 17 | use Symfony\Component\BrowserKit\History; |
18 | 18 | use Symfony\Component\BrowserKit\Response; |
| 19 | +use Symfony\Component\DomCrawler\Form as DomCrawlerForm; |
19 | 20 |
|
20 | 21 | class SpecialResponse extends Response |
21 | 22 | { |
@@ -877,4 +878,42 @@ public function testInternalRequestNull() |
877 | 878 | $client = new TestClient(); |
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 new "array $serverParameters = array()" argument in version 5.0, not defining it is deprecated since Symfony 4.2. |
| 885 | + */ |
| 886 | + public function testInheritedClassCallSubmitWithTwoArguments() |
| 887 | + { |
| 888 | + $clientChild = new ClassThatInheritClient(); |
| 889 | + $clientChild->setNextResponse(new Response('<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 ClassThatInheritClient extends Client |
| 895 | +{ |
| 896 | + protected $nextResponse = null; |
| 897 | + |
| 898 | + public function setNextResponse(Response $response) |
| 899 | + { |
| 900 | + $this->nextResponse = $response; |
| 901 | + } |
| 902 | + |
| 903 | + protected function doRequest($request) |
| 904 | + { |
| 905 | + if (null === $this->nextResponse) { |
| 906 | + return new Response(); |
| 907 | + } |
| 908 | + |
| 909 | + $response = $this->nextResponse; |
| 910 | + $this->nextResponse = null; |
| 911 | + |
| 912 | + return $response; |
| 913 | + } |
| 914 | + |
| 915 | + public function submit(DomCrawlerForm $form, array $values = array()) |
| 916 | + { |
| 917 | + return parent::submit($form, $values); |
| 918 | + } |
880 | 919 | } |
0 commit comments