Skip to content

Conversation

gnugat
Copy link

@gnugat gnugat commented May 5, 2015

As discussed in #4503, I've started to rewrite an article I've published about writing tests in third party bundles.

At this stage this PR should be considered as a Work In Progress as I'm not sure if it contains too much information (tests for third party bundles could be the subject of a whole section), not enough examples, or if it's simply irrelevant.

I'd be more than happy to take any feedback :) .

Copy link
Member

Choose a reason for hiding this comment

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

og -> of

@xabbuh
Copy link
Member

xabbuh commented May 6, 2015

You will have to add a reference to the new document in /cookbook/map.rst.inc too.

Copy link
Contributor

Choose a reason for hiding this comment

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

an console => a console

Took @javiereguiluz, @xabbuh and @pyrech feedback into account: * Fixed RST (use of double back quote) * Fixed typos * Removed use of first person * Indexed article in cookbook/map.rst.inc
@gnugat
Copy link
Author

gnugat commented May 6, 2015

Thanks @javiereguiluz, @xabbuh and @pyrech for all your feedbacks. I've taken them into account in a separate commit to make it easier to spot the diff.
If the PR gets accepted, I'll squash them into one.

@wouterj
Copy link
Member

wouterj commented May 6, 2015

As you're writing reStructured text and not markdown, the extension has to be .rst and not .md

Copy link
Member

Choose a reason for hiding this comment

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

"Writing Tests for Third Party Bundles" (we follow the "capitialize all words, except from closed-class words" title case standard)

@gnugat
Copy link
Author

gnugat commented Aug 2, 2015

Thanks @cordoval, @xabbuh, @wouterj and @stof for your feedback, I've taken it into account.

Copy link
Member

Choose a reason for hiding this comment

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

this relies on the next section to create the console, so it look weird

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure how to improve this part: should I remove it, or move it around? I could use some advice here :)

Copy link
Member

Choose a reason for hiding this comment

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

I propose to convert this to a simple sidebar and adding it after the Running Commands section. Like:

.. sidebar:: Visiting Pages in the Browser As you can run commands now, it is possible to run the internal webserver to visit the pages in a browser. In order to do this, you have to add a minimal front controller (just like the one that can be found in the Symfony Standard Edition::  // Tests/Functional/app/web.php  use Symfony\Component\HttpFoundation\Request;  require_once __DIR__.'/autoload.php';  $kernel = new AppKernel('prod', false);  $request = Request::createFromGlobals();  $response = $kernel->handle($request);  $response->send(); Now, you can execute the ``server:run`` comand: .. code-block:: bash   $ php Tests/Functional/app/console.php server:run -d Tests/app
Copy link
Member

Choose a reason for hiding this comment

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

Actually, I propose to rename web.php to app_test.php and then use php Tests/Functional/app/console.php server:run --env=test -d Tests/Functional/app. This way, everything works as expected

@theofidry
Copy link
Contributor

Might be also good to show how to test some elements of the dependency injection like compilers, extension and configuration:

Exemple in DunglasApiBundle:

Another one with HautelookAliceBundle

@gnugat
Copy link
Author

gnugat commented Sep 12, 2015

@theofidry I'll add those links to the section discussed here: #5232 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

We usually have a little introduction paragraph at the start of the article, instead of starting with the text directly. What about adding such a paragraph here as well? For instance:

When creating a shared bundle, you need to verify if the bundle works as it should. The best practice is to write automatic functional tests. This article will guide you through setting up and running such tests.

@wouterj
Copy link
Member

wouterj commented Sep 12, 2015

@gnugat I've decorated this article with comments again, sorry for that... I don't think they are very hard to fix, but if you don't want to fix them, feel free to just say it and we'll take it from here.

The article looks like a really nice getting started guide. Some sections are duplicate with book/testing, but we can fix these duplications in another PR.

Copy link
Member

Choose a reason for hiding this comment

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

I'd remove this block - it's a bit of a maintenance problem. Instead, just describe how you could create a kernel and a "fake" request in order to test your bundle.

@weaverryan
Copy link
Member

At this point, I don't think this should be included in the docs. We have too much to maintain, so we need to focus our efforts on core things needed by users. This doesn't make this a bad article at all (though the PR has stalled) - I'd rather existing bundles serve as the best resource for learning how to test your reusable bundle.

Cheers!

@weaverryan weaverryan closed this Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment