Skip to content

[Security] Readd the correct tests #15932

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

Closed
wants to merge 2 commits into from
Closed

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Sep 26, 2015

Something went wrong with the merging #15151 , resulting in the wrong tests for the abstract voter.

Q A
Fixed tickets -
License MIT

*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Copy link
Member

Choose a reason for hiding this comment

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

this must be kept

@stof
Copy link
Member

stof commented Sep 26, 2015

You should not remove tests for the BC layers. Bc layers must be tested too (this is why we have the legacy group)

@wouterj wouterj mentioned this pull request Sep 26, 2015
@wouterj
Copy link
Member Author

wouterj commented Sep 26, 2015

@stof if you look at the referenced PR, you see that there is a LegacyAbstractVoterTest added. This one did make it succesfully into the 2.8 branch, there was just a problem with this file.

@stof
Copy link
Member

stof commented Sep 26, 2015

@wouterj why splitting it into 2 files instead of having them in the same file ? We stopped moving things around into Legacy* classes when we introduced the PHPUnit bridge, because it makes merging branches easier if the tests are simply tagged as legacy in the newer branch instead of being moved to a different file (it avoids having to fix conflicts each time we add a test for a new case in the all branch and this test has to belong to the legacy ones)

@stof
Copy link
Member

stof commented Sep 26, 2015

Btw, I'm quite sure this is what happened here: there was a conflict between branches when merging things, and the conflict was not resolved in the right way, keeping the wrong version of the file...

@wouterj
Copy link
Member Author

wouterj commented Sep 26, 2015

@stof I find it way more easy to read (both the code and the report in case of failure) to have many tests and multiple test cases instead of having one very big data provider and a couple of tests using this provider.

If you think having one class and a data provider is the better solution, I'm open to rewrite the test to use a data provider (the current tests contains more scenarios than the older tests).

@stof
Copy link
Member

stof commented Sep 26, 2015

@wouterj the legacy tests and the non-legacy ones are not exactly the same. We would have several tests, (for the legacy and non-legacy cases), not a data provider returning the deprecated and non deprecated voters (which would be a pain to handle for the legacy group btw).
We need some tests specific to testing some of the BC layers anyway, which don't fit well in your setup of running the same tests against a different implementation (see the test added in #15921)

@wouterj
Copy link
Member Author

wouterj commented Sep 27, 2015

@stof such specific tests can just be added to the legacy test case: wouterj@df36835#diff-38a5c5ac2cd48e853e59014e2ff23f14R33

Anyway, as it seems you really dislike this approach, I've rewrote the tests to use one very big data provider...


public function getTests()
{
$object = $this->getMock('AbstractVoterTest_Object');
Copy link
Member Author

Choose a reason for hiding this comment

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

setUp seems to be run after data providers, so we need to redefine object here

Copy link
Member

Choose a reason for hiding this comment

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

creating mocks in the data provider is a bad idea. These mocks will not be associated with the test properly (as they are created outside the test), which can lead to weird behaviors.

@wouterj wouterj closed this Sep 27, 2015
fabpot added a commit that referenced this pull request Sep 28, 2015
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] Improve AbstractVoter tests

Applying the improved tests from #15932 into the oldest possible branch.

Merge conflicts from 2.7 into 2.8 caused by this PR do not need to be done carefully, I'll create a new PR for 2.8 updating the tests as soon as these changes are merged up.

| Q             | A
| ------------- | ---
| Fixed tickets | -
| License       | MIT

Commits
-------

5ff741d Readd the correct tests
fabpot added a commit to symfony/security that referenced this pull request Sep 28, 2015
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] Improve AbstractVoter tests

Applying the improved tests from symfony/symfony#15932 into the oldest possible branch.

Merge conflicts from 2.7 into 2.8 caused by this PR do not need to be done carefully, I'll create a new PR for 2.8 updating the tests as soon as these changes are merged up.

| Q             | A
| ------------- | ---
| Fixed tickets | -
| License       | MIT

Commits
-------

5ff741d Readd the correct tests
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.

3 participants