Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added new methods submitForm and clickLink to Client class #27807

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

Merged
merged 1 commit into from
Jul 12, 2018

Conversation

nowiko
Copy link
Contributor

@nowiko nowiko commented Jul 2, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

Added new methods to BrowserKit/Client to simplify work with links and forms.
Related to #27627

$client->setNextResponse(new Response('<html><form action="/foo"><input type="submit" value="Register" /></form></html>'));
$client->request('GET', 'http://www.example.com/foo/foobar');

$client->submitForm('Register', array(), 'POST');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to add a test case where actual values are submitted along, this case is not covered right now.

@nowiko
Copy link
Contributor Author

nowiko commented Jul 2, 2018

@iltar Please review that applied changes are suitable.

@linaori
Copy link
Contributor

linaori commented Jul 2, 2018

Added test looks good to me 👍

@fabpot
Copy link
Member

fabpot commented Jul 3, 2018

I think we also tests for when the link/form is not found.

@nicolas-grekas nicolas-grekas added this to the next milestone Jul 3, 2018
@nowiko
Copy link
Contributor Author

nowiko commented Jul 3, 2018

@fabpot
I have added test cases if link or form cannot be found. Please, let me know if this should be modified, or additional check for form/link existence should be performed on the method level.

@fabpot fabpot force-pushed the simplify-functional-tests branch from 11bbed3 to e098edd Compare July 12, 2018 07:05
@fabpot
Copy link
Member

fabpot commented Jul 12, 2018

Thank you @nowiko.

@fabpot fabpot merged commit e098edd into symfony:master Jul 12, 2018
fabpot added a commit that referenced this pull request Jul 12, 2018
…lass (nowiko)

This PR was squashed before being merged into the 4.2-dev branch (closes #27807).

Discussion
----------

Added new methods submitForm and clickLink to Client class

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Added new methods to BrowserKit/Client to simplify work with links and forms.
Related to #27627

Commits
-------

e098edd Added new methods submitForm and clickLink to Client class
fabpot added a commit that referenced this pull request Jul 18, 2018
…itForm() methods (javiereguiluz)

This PR was squashed before being merged into the 4.2-dev branch (closes #27956).

Discussion
----------

Added types and tweaked PHPdoc of clickLink() and submitForm() methods

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | -

I wanted to suggest these changes to #27807 but I failed to do that before it was merged.

Commits
-------

be9d578 Added types and tweaked PHPdoc of clickLink() and submitForm() methods
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jul 18, 2018
This PR was squashed before being merged into the master branch (closes #10071).

Discussion
----------

Added docs for clickLink() and submitForm()

This documents symfony/symfony#27807

Commits
-------

0668ccc Added docs for clickLink() and submitForm()
@stof
Copy link
Member

stof commented Sep 13, 2018

these 2 methods will trigger a fatal error if you call them before calling request, as getCrawler will return null in that case (that's a deprecated usage, but it does not throw yet).
As these are new APIs, we should forbid them already when we don't have a crawler (thus, doing separate checks would allow to have a better exception message, as it would talk about the right method being used)

symfony-splitter pushed a commit to symfony/browser-kit that referenced this pull request Sep 29, 2018
…(xabbuh)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[BrowserKit] throw exception when request() wasn't called

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony#27807 (comment)

Commits
-------

41cfde19f6 throw exception when request() wasn't called
nicolas-grekas added a commit that referenced this pull request Sep 29, 2018
…(xabbuh)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[BrowserKit] throw exception when request() wasn't called

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | #27807 (comment)

Commits
-------

41cfde1 throw exception when request() wasn't called
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
@fabpot fabpot mentioned this pull request Nov 3, 2018
@fabpot fabpot mentioned this pull request Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants