Skip to content

Commit 46e0ecc

Browse files
committed
Replace calls to setExpectedException by Pollyfill
1 parent cd97bb2 commit 46e0ecc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Tests/Authorization/AccessDecisionManagerTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Tests\Authorization;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1617
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
1718
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
@@ -20,6 +21,8 @@
2021

2122
class AccessDecisionManagerTest extends TestCase
2223
{
24+
use ForwardCompatTestTrait;
25+
2326
/**
2427
* @expectedException \InvalidArgumentException
2528
*/
@@ -147,12 +150,8 @@ public function testVotingWrongTypeNoVoteMethod()
147150
$exception = LogicException::class;
148151
$message = sprintf('stdClass should implement the %s interface when used as voter.', VoterInterface::class);
149152

150-
if (method_exists($this, 'expectException')) {
151-
$this->expectException($exception);
152-
$this->expectExceptionMessage($message);
153-
} else {
154-
$this->setExpectedException($exception, $message);
155-
}
153+
$this->expectException($exception);
154+
$this->expectExceptionMessage($message);
156155

157156
$adm = new AccessDecisionManager([new \stdClass()]);
158157
$token = $this->getMockBuilder(TokenInterface::class)->getMock();

0 commit comments

Comments
 (0)