fix tests for the AbstractVoter
class
* 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.
This commit is contained in:
parent
634aafc3ac
commit
9fe3b7697b
@ -95,7 +95,7 @@ class AbstractVoterTest_LegacyVoter extends AbstractVoter
|
|||||||
{
|
{
|
||||||
protected function getSupportedClasses()
|
protected function getSupportedClasses()
|
||||||
{
|
{
|
||||||
return array('AbstractVoterTest_Object');
|
return array('stdClass');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSupportedAttributes()
|
protected function getSupportedAttributes()
|
||||||
@ -113,7 +113,7 @@ class AbstractVoterTest_NothingImplementedVoter extends AbstractVoter
|
|||||||
{
|
{
|
||||||
protected function getSupportedClasses()
|
protected function getSupportedClasses()
|
||||||
{
|
{
|
||||||
return array('AbstractVoterTest_Object');
|
return array('stdClass');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSupportedAttributes()
|
protected function getSupportedAttributes()
|
||||||
|
@ -1,42 +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\Core\Tests\Authorization\Voter;
|
|
||||||
|
|
||||||
use Symfony\Component\Security\Core\Authorization\Voter\AbstractVoter;
|
|
||||||
|
|
||||||
class LegacyAbstractVoterTest_Voter extends AbstractVoter
|
|
||||||
{
|
|
||||||
protected function getSupportedClasses()
|
|
||||||
{
|
|
||||||
return array('AbstractVoterTest_Object');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getSupportedAttributes()
|
|
||||||
{
|
|
||||||
return array('EDIT', 'CREATE');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function isGranted($attribute, $object, $user = null)
|
|
||||||
{
|
|
||||||
return 'EDIT' === $attribute;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LegacyAbstractVoterTest extends AbstractVoterTest
|
|
||||||
{
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->voter = new LegacyAbstractVoterTest_Voter();
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user