Skip to content

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

Merged
merged 3 commits into from
Apr 15, 2017

Conversation

javiereguiluz
Copy link
Member

This fixes #6741.

));
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
Copy link
Contributor

Choose a reason for hiding this comment

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

whilst => while?

Copy link
Member Author

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
Copy link
Contributor

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.

$this->logIn();
$crawler = $this->client->request('GET', '/admin');

$this->assertTrue($this->client->getResponse()->isSuccessful());
Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member Author

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.

Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

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

👍

@HeahDude HeahDude added this to the 2.7 milestone Apr 15, 2017
@xabbuh
Copy link
Member

xabbuh commented Apr 15, 2017

Thank you Javier.

@xabbuh xabbuh merged commit fc8e8c6 into symfony:2.7 Apr 15, 2017
xabbuh added a commit that referenced this pull request Apr 15, 2017
…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
xabbuh added a commit that referenced this pull request Apr 15, 2017
xabbuh added a commit that referenced this pull request Apr 15, 2017
* 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
xabbuh added a commit that referenced this pull request Apr 15, 2017
* 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"
  ...
xabbuh added a commit that referenced this pull request Apr 15, 2017
xabbuh added a commit that referenced this pull request Apr 15, 2017
* 2.7:
  Made unmapped field example in forms chapter more descriptive
  [#7507] fix namespace
weaverryan added a commit that referenced this pull request Apr 15, 2017
* 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
weaverryan added a commit that referenced this pull request Apr 15, 2017
* 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
  ...
@javiereguiluz javiereguiluz deleted the fix_6741 branch May 24, 2018 16:05
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.

5 participants