Skip to content

Commit 11bfea7

Browse files
committed
Replace calls to setExpectedException by Pollyfill
1 parent a6528cf commit 11bfea7

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public function testFormatTypeCurrency($formatter, $value)
332332
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
333333
}
334334

335-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
335+
$this->expectException($exceptionCode);
336336

337337
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
338338
}
@@ -715,7 +715,7 @@ public function testParseTypeDefault()
715715
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
716716
}
717717

718-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
718+
$this->expectException($exceptionCode);
719719

720720
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
721721
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
@@ -841,7 +841,7 @@ public function testParseTypeCurrency()
841841
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
842842
}
843843

844-
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
844+
$this->expectException($exceptionCode);
845845

846846
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
847847
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);

Tests/Util/GitRepositoryTest.php

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

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait;
1516
use Symfony\Component\Filesystem\Filesystem;
1617
use Symfony\Component\Intl\Exception\RuntimeException;
1718
use Symfony\Component\Intl\Util\GitRepository;
@@ -21,6 +22,8 @@
2122
*/
2223
class GitRepositoryTest extends TestCase
2324
{
25+
use ForwardCompatTestTrait;
26+
2427
private $targetDir;
2528

2629
const REPO_URL = 'https://github.com/symfony/intl.git';
@@ -39,11 +42,7 @@ protected function cleanup()
3942

4043
public function testItThrowsAnExceptionIfInitialisedWithNonGitDirectory()
4144
{
42-
if (method_exists($this, 'expectException')) {
43-
$this->expectException(RuntimeException::class);
44-
} else {
45-
$this->setExpectedException(RuntimeException::class);
46-
}
45+
$this->expectException(RuntimeException::class);
4746

4847
@mkdir($this->targetDir, 0777, true);
4948

0 commit comments

Comments
 (0)