8000 Added docs for clickLink() and submitForm() by javiereguiluz · Pull Request #10071 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added docs for clickLink() and submitForm() #10071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finished the docs
  • Loading branch information
javiereguiluz committed Jul 18, 2018
commit 962f310c5eb030f643b038c3285d499ca6046a04
22 changes: 22 additions & 0 deletions components/browser_kit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ performs the needed HTTP GET request to simulate the link click::
$link = $crawler->selectLink('Go elsewhere...')->link();
$client->click($link);

If you don't need the low level ``Link`` object, you can use the ``clickLink()``
shortcut to click links more easily::

// ...
$client->clickLink('Go elsewhere...');

.. versionadded:: 4.2
The ``clickLink()`` method was introduced in Symfony 4.2.

Submitting Forms
~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -136,6 +145,19 @@ method (which makes the needed HTTP POST request to submit the form contents)::
// submit that form
$crawler = $client->submit($form);

If you don't need the low level ``Form`` object, you can use the
``submitForm()`` shortcut to submit the form more easily::

// ...
$client->submitForm('Log in', [
'login' => 'symfonyfan',
'password' => 'anypass',
'file' => __FILE__,
]);

.. versionadded:: 4.2
The ``submitForm()`` method was introduced in Symfony 4.2.

Cookies
-------

Expand Down
5 changes: 3 additions & 2 deletions testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,11 @@ their type::

.. tip::

The ``submit()`` method defines a third optional argument to add custom
HTTP headers when submitting the form::
The ``submit()`` and ``submitForm()`` methods define optional arguments to
add custom server parameters and HTTP headers when submitting the form::

$client->submit($form, array(), array('HTTP_ACCEPT_LANGUAGE' => 'es'));
$client->submitForm($button, array(), 'POST', array('HTTP_ACCEPT_LANGUAGE' => 'es'));

.. versionadded:: 4.1
The feature to add custom HTTP headers was introduced in Symfony 4.1.
Expand Down
0