Skip to content

[Security] Fix tests in 2.8 #15961

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 1 commit into from
Sep 28, 2015
Merged

[Security] Fix tests in 2.8 #15961

merged 1 commit into from
Sep 28, 2015

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Sep 28, 2015

ping @fabpot

@fabpot
Copy link
Member

fabpot commented Sep 28, 2015

Thank you @wouterj.

@fabpot fabpot merged commit 20c90f5 into symfony:2.8 Sep 28, 2015
fabpot added a commit that referenced this pull request Sep 28, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

[Security] Fix tests in 2.8

ping @fabpot

Commits
-------

20c90f5 Fix tests in 2.8
@fabpot
Copy link
Member

fabpot commented Sep 28, 2015

Tests are still broken for me :(

@stof
Copy link
Member

stof commented Sep 28, 2015

@wouterj please check your changes. The tests you modified here are failing

@wouterj
Copy link
Member Author

wouterj commented Sep 28, 2015

@stof @fabpot LegacyAbstractVoterTest should be removed, forgot to do it in this PR. I cannot do it before this evening, so feel free to do it yourself.

@fabpot
Copy link
Member

fabpot commented Sep 28, 2015

That's not enough to fix the tests:

PHPUnit 4.8.6 by Sebastian Bergmann and contributors.

...............................................................  63 / 572 ( 11%)
............................................................... 126 / 572 ( 22%)
.....................................FFFFF....F................ 189 / 572 ( 33%)
............................................................... 252 / 572 ( 44%)
............................................................... 315 / 572 ( 55%)
............................................................... 378 / 572 ( 66%)
............................................................... 441 / 572 ( 77%)
............................................................... 504 / 572 ( 88%)
............................................................... 567 / 572 ( 99%)
.....

Time: 6.32 seconds, Memory: 36.25Mb

There were 6 failures:

1) Symfony\Component\Security\Core\Tests\Authorization\Voter\AbstractVoterTest::testVoteLegacy with data set #0 (array('EDIT'), 1, stdClass Object (), 'ACCE
SS_GRANTED if attribute a...access')
ACCESS_GRANTED if attribute and class are supported and attribute grants access
Failed asserting that 0 matches expected 1.

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php:66

2) Symfony\Component\Security\Core\Tests\Authorization\Voter\AbstractVoterTest::testVoteLegacy with data set #1 (array('CREATE'), -1, stdClass Object (), 'A
CCESS_DENIED if attribute an...access')
ACCESS_DENIED if attribute and class are supported and attribute does not grant access
Failed asserting that 0 matches expected -1.

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php:66

3) Symfony\Component\Security\Core\Tests\Authorization\Voter\AbstractVoterTest::testVoteLegacy with data set #2 (array('DELETE', 'EDIT'), 1, stdClass Object
 (), 'ACCESS_GRANTED if one attribu...access')
ACCESS_GRANTED if one attribute is supported and grants access
Failed asserting that 0 matches expected 1.

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php:66

4) Symfony\Component\Security\Core\Tests\Authorization\Voter\AbstractVoterTest::testVoteLegacy with data set #3 (array('DELETE', 'CREATE'), -1, stdClass Obj
ect (), 'ACCESS_DENIED if one attribut...access')
ACCESS_DENIED if one attribute is supported and denies access
Failed asserting that 0 matches expected -1.

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php:66

5) Symfony\Component\Security\Core\Tests\Authorization\Voter\AbstractVoterTest::testVoteLegacy with data set #4 (array('CREATE', 'EDIT'), 1, stdClass Object
 (), 'ACCESS_GRANTED if one attribu...access')
ACCESS_GRANTED if one attribute grants access
Failed asserting that 0 matches expected 1.

src/Symfony/Component/Security/Core/Tests/Authorization/Voter/AbstractVoterTest.php:66

6) Symfony\Component\Security\Core\Tests\Authorization\Voter\AbstractVoterTest::testNoOverriddenMethodsThrowsException
Failed asserting that exception of type "\BadMethodCallException" is thrown.

FAILURES!
Tests: 572, Assertions: 1214, Failures: 6.

Legacy deprecation notices (15)

protected function getSupportedClasses()
{
return array('stdClass');
return array('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.

This change should be reverted, it should accept stdClass.

Copy link
Member Author

Choose a reason for hiding this comment

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

Afaics, this should fix the tests (but I'm on a mobile now, sp can't be 100% sure).

@fabpot fabpot mentioned this pull request Sep 28, 2015
xabbuh added a commit to xabbuh/symfony that referenced this pull request Sep 28, 2015
* The `LegacyAbstractVoterTest` class is not needed anymore, tests have
  been moved to the `AbstractVoterTest` class tagging them with the
  legacy group.
* Tests are applied on `stdClass` object instances. Thus, the legacy
  voter fixture class must not support `AbstractVoterTest_Object`
  instances, but support `stdClass` objects instead.
* Remove a test that checked for a `BadMethodCallException` being
  thrown. This seems to have been added accidentally in symfony#15961.
xabbuh added a commit to xabbuh/symfony that referenced this pull request Sep 28, 2015
* The `LegacyAbstractVoterTest` class is not needed anymore, tests have
  been moved to the `AbstractVoterTest` class tagging them with the
  legacy group.
* Tests are applied on `stdClass` object instances. Thus, the legacy
  voter fixture class must not support `AbstractVoterTest_Object`
  instances, but support `stdClass` objects instead.
* Remove a test that checked for a `BadMethodCallException` being
  thrown. This seems to have been added accidentally in symfony#15961.
xabbuh added a commit to xabbuh/symfony that referenced this pull request Sep 28, 2015
* The `LegacyAbstractVoterTest` class is not needed anymore, tests have
  been moved to the `AbstractVoterTest` class tagging them with the
  legacy group.
* Tests are applied on `stdClass` object instances. Thus, the legacy
  voter fixture class must not support `AbstractVoterTest_Object`
  instances, but support `stdClass` objects instead.
* Remove a test that checked for a `BadMethodCallException` being
  thrown. This seems to have been added accidentally in symfony#15961.
fabpot added a commit that referenced this pull request Sep 28, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

[Security] fix tests for the `AbstractVoter` class

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15961, #15968
| License       | MIT
| Doc PR        |

* The `LegacyAbstractVoterTest` class is not needed anymore, tests have
  been moved to the `AbstractVoterTest` class tagging them with the
  legacy group.
* Tests are applied on `stdClass` object instances. Thus, the legacy
  voter fixture class must not support `AbstractVoterTest_Object`
  instances, but support `stdClass` objects instead.
* Remove a test that checked for a `BadMethodCallException` being
  thrown. This seems to have been added accidentally in #15961.

Commits
-------

9fe3b76 fix tests for the `AbstractVoter` class
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.

4 participants