Skip to content

Commit 46c8dc3

Browse files
committed
feature #36034 [PhpUnitBridge] Deprecate @expectedDeprecation annotation (hkdobrev)
This PR was squashed before being merged into the 5.1-dev branch. Discussion ---------- [PhpUnitBridge] Deprecate @expectedDeprecation annotation | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes<!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A | License | MIT | Doc PR | N/A Addresses https://github.com/orgs/symfony/projects/1#card-32934769 as a follow-up to #35192. Deprecating `@expectedDeprecation` annotation on tests in favour of the `expectDeprecation()` method similar to other PHPUnit deprecations of annotations in favour of methods. Commits ------- 36a57cc7c2 [PhpUnitBridge] Deprecate @expectedDeprecation annotation
2 parents 9e7adbd + 3b7d3e7 commit 46c8dc3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Tests/Authorization/Voter/RoleVoterTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
namespace Symfony\Component\Security\Core\Tests\Authorization\Voter;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1516
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
1617
use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter;
1718
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
1819

1920
class RoleVoterTest extends TestCase
2021
{
22+
use ExpectDeprecationTrait;
23+
2124
/**
2225
* @dataProvider getVoteTests
2326
*/
@@ -46,10 +49,10 @@ public function getVoteTests()
4649

4750
/**
4851
* @group legacy
49-
* @expectedDeprecation Since symfony/security-core 5.1: The ROLE_PREVIOUS_ADMIN role is deprecated and will be removed in version 6.0, use the IS_IMPERSONATOR attribute instead.
5052
*/
5153
public function testDeprecatedRolePreviousAdmin()
5254
{
55+
$this->expectDeprecation('Since symfony/security-core 5.1: The ROLE_PREVIOUS_ADMIN role is deprecated and will be removed in version 6.0, use the IS_IMPERSONATOR attribute instead.');
5356
$voter = new RoleVoter();
5457

5558
$voter->vote($this->getTokenWithRoleNames(['ROLE_USER', 'ROLE_PREVIOUS_ADMIN']), null, ['ROLE_PREVIOUS_ADMIN']);

0 commit comments

Comments
 (0)