Skip to content
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

Add browserkit component documentation #4312

Closed
wants to merge 15 commits into from

Conversation

yamiko-ninja
Copy link
Contributor

Working on documentation for the browser kit. Fixes #954
Pull request #4310 was to the wrong branch so making a new one

single: Components; BrowserKit

The BrowserKit Component
=========================
Copy link
Contributor

Choose a reason for hiding this comment

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

- 1 x =

@yamiko-ninja
Copy link
Contributor Author

This month is pretty busy so progress will be a little slow. What topics in particular do you think I should include in the documentation?

@wouterj
Copy link
Member

wouterj commented Oct 12, 2014

The most important part is explaining how the component works (by using a Client to simulate the HTTP layer). This means you have to explain that you need to create a new client by extending Client and implementing the doRequest() method:

    /**
     * Makes a request.
     *
     * @param object $request An origin request instance
     *
     * @return object An origin response instance
     */
    abstract protected function doRequest($request);

Then you need to tell something about the Request and Response objects (since that's important for the doRequest method).

After that, you can talk about some more advanced topics like using Cookie and CookieJar, History and insulated requests (by implementing Client#getScript()).

One tip: Look at how Symfony, Laravel and Goutte implemented the Client for examples and look at the tests on how these classes work.

@stof
Copy link
Member

stof commented Oct 13, 2014

Btw, I think it is worth linking to the 2 existing implementations of the BrowserKit client:

  • the HttpKernel one which simulates requests by calling the HttpKernel directly for testing purposes
  • Goutte, which performs real HTTP requests.


For an implementation based on HttpKernelInterface, have a look at the Client provided by the :doc:`/components/http_kernel/introduction`.

.. _Packagist: https://packagist.org/packages/symfony/event-dispatcher
Copy link
Member

Choose a reason for hiding this comment

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

wrong link

@wouterj
Copy link
Member

wouterj commented Feb 19, 2015

ping @yamiko-ninja do you have time in the future to bring this PR to the next level? If not, please say so, then someone else can take it over.

@yamiko-ninja
Copy link
Contributor Author

@wouterj ahh forgot about it!

If someone wants to take over they can. otherwise I will put this on my todo list to do by the end of April. About to move in a few weeks.

@wouterj
Copy link
Member

wouterj commented May 15, 2015

Hi @yamiko-ninja! Just wanted to let you know that there will be a doc sprint day on May 23rd. You can join in then to get quick feedback & other help. If you no longer have the motivation/time to finish this PR, we can also put it on the list for other people to take over.

Thanks for the bootstrapping!

@yamiko-ninja
Copy link
Contributor Author

I will put that day on my calendar and will do some more work on it in the meantime. I have time to work on this again now.

@javiereguiluz
Copy link
Member

@wouterj I have some concerns about this PR. @yamiko-ninja has done a great work bootstraping the documentation of the component. However, if we expect him to complete all the documentation, maybe that's too much for a single person (hence my concerns).

What do you think if we lower the expectations of this PR to consider it just the bootstraping of the component documentation. That way we can polish @yamiko-ninja's current work a bit and merge it. Then, we outline all the contents we want to add to this section and complete that task in further pull requests.

@xabbuh
Copy link
Member

xabbuh commented Jun 22, 2015

I agree with you @javiereguiluz for two reasons:

  1. Only bootstrapping a rough skeleton would make it easier to get something started.
  2. We can then create a list of smaller TODOs which would make it easier for other contributors to pick a single simple task.

@yamiko-ninja
Copy link
Contributor Author

I agree. I have only made a few contributions here and there I would be fine with someone else taking over.

I am also not very knowledgeable about this component so I have been adding docs whenever I learn something about it.


.. code-block:: php

namespace ACME;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be AppBundle

Copy link
Member

Choose a reason for hiding this comment

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

No, we are in the components section here. It should not use framework things like bundles

@yamiko-ninja yamiko-ninja changed the title [WIP]Add browserkit component documentation Add browserkit component documentation Nov 10, 2015
@yamiko-ninja
Copy link
Contributor Author

I added in some docs on cookies. I think this is a good start and other can add more to it if they like. With that in mind I removed the [WIP] from the title.


The BrowserKit component simulates the behavior of a web browser.

The BrowserKit component allows you to make web request, click on links and submit forms.
Copy link
Member

Choose a reason for hiding this comment

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

requests

Installation
------------

You can install the component in 2 different ways:
Copy link
Member

Choose a reason for hiding this comment

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

"two" instead of "2"

@xabbuh
Copy link
Member

xabbuh commented Nov 12, 2015

This looks pretty good so far. Thanks for your work @yamiko-ninja! I have left you a few comments (I wasn't able to look into this too deeply yet). And could you please also update this so that each lines is wrapped after the first word that crosses the 72nd character?

@yamiko-ninja
Copy link
Contributor Author

@xabbuh thanks for all the corrections. I will make the changes over the weekend.

@javiereguiluz
Copy link
Member

@yamiko-ninja you did a great work in this pull request. We just need a final push to finish it. That's what I'm trying to do in #6072. I've reused your original commits, so you'll get full credit for your work once the other pull request is merged. Thanks!

@wouterj wouterj closed this Dec 23, 2015
xabbuh added a commit that referenced this pull request Feb 9, 2016
…ninja, robert Parker, javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

Add browserkit component documentation

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | yes
| Applies to    | all
| Fixed tickets | -

This PR tries to finish the fantastic work made by @yamiko-ninja in #4312. Please review it so I can improve/finish it and we can merge it before year's end. Thanks!

Commits
-------

3f0858f Fixed a syntax issue
c9093a8 Implemented changes suggested by Wouter
e7056a8 Fixed a reference
5aec7c4 Minor fixes
fd35c93 Fixed a syntax issue
883c062 Finished the first version of the BrowserKit doc
03ea5a5 fix title underline
a1df783 spelling and formating
ea3fd71 Adding documentation for cookies
6b6e23a added docs on histroy
a3d158e added form submissions and moved creating a client to top
74cfecd more outlines, fixed link, added more about creating a client
dda78ba added a link snippit
94bb3bf fixed spelling
6997c4f make a basic request
b3d9eb3 added links to index and map files
f0f8a50 added links with info about clients and packagist link
1e5ca13 added in sections that I apln to fill out
9c007e9 syntax fix
645d50d fixed a few mistakes
93d7258 added introduction
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