Skip to content

Commit c191151

Browse files
peterrehmnicolas-grekas
authored andcommitted
Further refactorings to PHPUnit namespaces
1 parent 949e128 commit c191151

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,17 @@ public function formatTypeDoubleWithCurrencyStyleProvider()
306306

307307
/**
308308
* @dataProvider formatTypeCurrencyProvider
309-
* @expectedException \PHPUnit_Framework_Error_Warning
310309
*/
311310
public function testFormatTypeCurrency($formatter, $value)
312311
{
312+
$exceptionCode = 'PHPUnit\Framework\Error\Warning';
313+
314+
if (class_exists('PHPUnit_Framework_Error_Warning')) {
315+
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
316+
}
317+
318+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
319+
313320
$formatter->format($value, NumberFormatter::TYPE_CURRENCY);
314321
}
315322

@@ -641,11 +648,16 @@ public function parseProvider()
641648
);
642649
}
643650

644-
/**
645-
* @expectedException \PHPUnit_Framework_Error_Warning
646-
*/
647651
public function testParseTypeDefault()
648652
{
653+
$exceptionCode = 'PHPUnit\Framework\Error\Warning';
654+
655+
if (class_exists('PHPUnit_Framework_Error_Warning')) {
656+
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
657+
}
658+
659+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
660+
649661
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
650662
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
651663
}
@@ -782,11 +794,16 @@ public function parseTypeDoubleProvider()
782794
);
783795
}
784796

785-
/**
786-
* @expectedException \PHPUnit_Framework_Error_Warning
787-
*/
788797
public function testParseTypeCurrency()
789798
{
799+
$exceptionCode = 'PHPUnit\Framework\Error\Warning';
800+
801+
if (class_exists('PHPUnit_Framework_Error_Warning')) {
802+
$exceptionCode = 'PHPUnit_Framework_Error_Warning';
803+
}
804+
805+
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode);
806+
790807
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
791808
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY);
792809
}

0 commit comments

Comments
 (0)