diff options
author | Ryan Weaver <ryan@thatsquality.com> | 2015-09-23 21:45:13 -0400 |
---|---|---|
committer | Ryan Weaver <ryan@thatsquality.com> | 2015-09-23 21:45:13 -0400 |
commit | 654da1c8a77409f2de8a4604f47a08715ed9a8c4 (patch) | |
tree | a12dc5330356abe40f1a495cc41c3522046ddcbe /Tests/Core | |
parent | 7bfeb0feb9661a7c4bdcd86241868c8485e6b361 (diff) | |
download | symfony-security-654da1c8a77409f2de8a4604f47a08715ed9a8c4.zip symfony-security-654da1c8a77409f2de8a4604f47a08715ed9a8c4.tar.gz symfony-security-654da1c8a77409f2de8a4604f47a08715ed9a8c4.tar.bz2 |
Fixing test locations
Diffstat (limited to 'Tests/Core')
-rw-r--r-- | Tests/Core/Authentication/Voter/AbstractVoterTest.php | 90 | ||||
-rw-r--r-- | Tests/Core/LegacySecurityContextInterfaceTest.php | 31 |
2 files changed, 0 insertions, 121 deletions
diff --git a/Tests/Core/Authentication/Voter/AbstractVoterTest.php b/Tests/Core/Authentication/Voter/AbstractVoterTest.php deleted file mode 100644 index af7b82f..0000000 --- a/Tests/Core/Authentication/Voter/AbstractVoterTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Security\Tests\Core\Authentication\Voter; - -use Symfony\Component\Security\Core\Authorization\Voter\AbstractVoter; - -/** - * @author Roman Marintšenko <inoryy@gmail.com> - */ -class AbstractVoterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var AbstractVoter - */ - private $voter; - - private $token; - - protected function setUp() - { - $this->voter = new VoterFixture(); - - $tokenMock = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); - $tokenMock - ->expects($this->any()) - ->method('getUser') - ->will($this->returnValue('user')); - - $this->token = $tokenMock; - } - - /** - * @dataProvider getData - */ - public function testVote($expectedVote, $object, $attributes, $message) - { - $this->assertEquals($expectedVote, $this->voter->vote($this->token, $object, $attributes), $message); - } - - public function getData() - { - return array( - array(AbstractVoter::ACCESS_ABSTAIN, null, array(), 'ACCESS_ABSTAIN for null objects'), - array(AbstractVoter::ACCESS_ABSTAIN, new UnsupportedObjectFixture(), array(), 'ACCESS_ABSTAIN for objects with unsupported class'), - array(AbstractVoter::ACCESS_ABSTAIN, new ObjectFixture(), array(), 'ACCESS_ABSTAIN for no attributes'), - array(AbstractVoter::ACCESS_ABSTAIN, new ObjectFixture(), array('foobar'), 'ACCESS_ABSTAIN for unsupported attributes'), - array(AbstractVoter::ACCESS_GRANTED, new ObjectFixture(), array('foo'), 'ACCESS_GRANTED if attribute grants access'), - array(AbstractVoter::ACCESS_GRANTED, new ObjectFixture(), array('bar', 'foo'), 'ACCESS_GRANTED if *at least one* attribute grants access'), - array(AbstractVoter::ACCESS_GRANTED, new ObjectFixture(), array('foobar', 'foo'), 'ACCESS_GRANTED if *at least one* attribute grants access'), - array(AbstractVoter::ACCESS_DENIED, new ObjectFixture(), array('bar', 'baz'), 'ACCESS_DENIED for if no attribute grants access'), - ); - } -} - -class VoterFixture extends AbstractVoter -{ - protected function getSupportedClasses() - { - return array( - 'Symfony\Component\Security\Tests\Core\Authentication\Voter\ObjectFixture', - ); - } - - protected function getSupportedAttributes() - { - return array('foo', 'bar', 'baz'); - } - - protected function isGranted($attribute, $object, $user = null) - { - return $attribute === 'foo'; - } -} - -class ObjectFixture -{ -} - -class UnsupportedObjectFixture -{ -} diff --git a/Tests/Core/LegacySecurityContextInterfaceTest.php b/Tests/Core/LegacySecurityContextInterfaceTest.php deleted file mode 100644 index 5225eb5..0000000 --- a/Tests/Core/LegacySecurityContextInterfaceTest.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Security\Tests\Core; - -use Symfony\Component\Security\Core\SecurityContextInterface; -use Symfony\Component\Security\Core\Security; - -/** - * @group legacy - */ -class LegacySecurityContextInterfaceTest extends \PHPUnit_Framework_TestCase -{ - /** - * Test if the BC Layer is working as intended. - */ - public function testConstantSync() - { - $this->assertSame(Security::ACCESS_DENIED_ERROR, SecurityContextInterface::ACCESS_DENIED_ERROR); - $this->assertSame(Security::AUTHENTICATION_ERROR, SecurityContextInterface::AUTHENTICATION_ERROR); - $this->assertSame(Security::LAST_USERNAME, SecurityContextInterface::LAST_USERNAME); - } -} |