summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWouterJ <waldio.webdesign@gmail.com>2015-11-04 14:58:00 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2015-11-28 16:45:57 +0100
commit490d8f077ab8cfa465e6f2ab93a557a78b4d4635 (patch)
tree13922e5e1bfa0f51fd7cdeb793e15b7207e31080
parent9e5425dc3f06ca0bd0d7e30eb7573702f3ce1eca (diff)
downloadsymfony-security-490d8f077ab8cfa465e6f2ab93a557a78b4d4635.zip
symfony-security-490d8f077ab8cfa465e6f2ab93a557a78b4d4635.tar.gz
symfony-security-490d8f077ab8cfa465e6f2ab93a557a78b4d4635.tar.bz2
[SecurityBundle] Fix disabling of RoleHierarchyVoter when passing empty hierarchy
-rw-r--r--Core/Tests/Authorization/Voter/RoleHierarchyVoterTest.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/Core/Tests/Authorization/Voter/RoleHierarchyVoterTest.php b/Core/Tests/Authorization/Voter/RoleHierarchyVoterTest.php
index c50ecf3..4b03bac 100644
--- a/Core/Tests/Authorization/Voter/RoleHierarchyVoterTest.php
+++ b/Core/Tests/Authorization/Voter/RoleHierarchyVoterTest.php
@@ -33,4 +33,19 @@ class RoleHierarchyVoterTest extends RoleVoterTest
array(array('ROLE_FOO'), array('ROLE_FOOBAR'), VoterInterface::ACCESS_GRANTED),
));
}
+
+ /**
+ * @dataProvider getVoteWithEmptyHierarchyTests
+ */
+ public function testVoteWithEmptyHierarchy($roles, $attributes, $expected)
+ {
+ $voter = new RoleHierarchyVoter(new RoleHierarchy(array()));
+
+ $this->assertSame($expected, $voter->vote($this->getToken($roles), null, $attributes));
+ }
+
+ public function getVoteWithEmptyHierarchyTests()
+ {
+ return parent::getVoteTests();
+ }
}