-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Merged and improved the articles about testing + authentication #7507
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
Conversation
)); | ||
When your application is using a ``form_login`` authentication, you can make | ||
your tests faster by allowing them to use HTTP authentication. This way your | ||
tests authenticate with the simple and fast HTTP Basic method whilst your real |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whilst
=> while
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I treat them as synonyms. I think this is correct 🤓 but let's wait for more opinions.
but the following example shows a complete example that you can adapt to your | ||
needs:: | ||
|
||
// src/AppBundle/Tests/Controller/DefaultControllerTest.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be changed to //tests
when merged in 2.8 or 3.2.
testing/http_authentication.rst
Outdated
$this->logIn(); | ||
$crawler = $this->client->request('GET', '/admin'); | ||
|
||
$this->assertTrue($this->client->getResponse()->isSuccessful()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make use of $this->assertSame(Response::HTTP_OK, $this->client->getResponse());
which is much easier to debug, providing the wrong status code instead of just false
when failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this change. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thank you Javier. |
…cation (javiereguiluz, HeahDude) This PR was merged into the 2.7 branch. Discussion ---------- Merged and improved the articles about testing + authentication This fixes #6741. Commits ------- fc8e8c6 Fixed status code test be5fe37 Improved a test 211da90 Merged and improved the articles about testing + authentication
* 2.7: [#7507] fix component name [#7490] minor typo fix Added a note about redirections to absolute URLs in tests Added the changes suggested by reviewers Fixed status code test Improved a test Merged and improved the articles about testing + authentication Reworded the section about form overridding Update installation.rst Update prepend_extension.rst Update override.rst Update installation.rst Update inheritance.rst Unify placeholders in documentation and code
* 2.8: (46 commits) [#7507] fix component name [#7490] minor typo fix Added a note about redirections to absolute URLs in tests Added the changes suggested by reviewers [#7620] use generate() in PHP templates before 2.8 Fixed the RST syntax Improve example context [#5621] Enhancing example of using bundle config [#7601] minor tweak Update expiration.rst Update expiration.rst Update expiration.rst Update expiration.rst Minor reword and fixed the line length Improve specification explanation [#7664] minor wording tweak Rewords and minor fixes Add an explanation about «constraints» validation [#7645] enumerate ordered list items implicitly Adding a new article about "Creating a Bug Reproducer" ...
* 2.7: Made unmapped field example in forms chapter more descriptive [#7507] fix namespace
* 2.8: Rewriting the service container docs Minor reword Adding a tip for validation in forms without class Added a note about the .htaccess files included by Symfony apps Made unmapped field example in forms chapter more descriptive [#7507] fix namespace Explain better how to enable the ClockMock annotation
* 3.2: (71 commits) Rewriting the service container docs Minor reword Adding a tip for validation in forms without class [#7217] add versionadded directives [#7203] merge note and versionadded directive Use the new configurator YAML syntax Added a note about the .htaccess files included by Symfony apps Made unmapped field example in forms chapter more descriptive [#7507] fix namespace [#7507] fix component name [#7490] minor typo fix Added a note about redirections to absolute URLs in tests [#7204] link to API doc Added docs for JsonResponse::fromJsonString Added the changes suggested by reviewers [#7620] use generate() in PHP templates before 2.8 Fixed the RST syntax Improve example context Minor formatting changes [#7519] some minor tweaks ...
This fixes #6741.