use expectWarning() when possible

This commit is contained in:
Christian Flothmann 2020-08-13 16:16:26 +02:00
parent 6972bc232d
commit 26dd39eb06

View File

@ -324,7 +324,11 @@ abstract class AbstractNumberFormatterTest extends TestCase
*/ */
public function testFormatTypeCurrency($formatter, $value) public function testFormatTypeCurrency($formatter, $value)
{ {
$this->expectException(Warning::class); if (method_exists($this, 'expectWarning')) {
$this->expectWarning();
} else {
$this->expectException(Warning::class);
}
$formatter->format($value, NumberFormatter::TYPE_CURRENCY); $formatter->format($value, NumberFormatter::TYPE_CURRENCY);
} }
@ -701,7 +705,11 @@ abstract class AbstractNumberFormatterTest extends TestCase
public function testParseTypeDefault() public function testParseTypeDefault()
{ {
$this->expectException(Warning::class); if (method_exists($this, 'expectWarning')) {
$this->expectWarning();
} else {
$this->expectException(Warning::class);
}
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT); $formatter->parse('1', NumberFormatter::TYPE_DEFAULT);
@ -821,7 +829,11 @@ abstract class AbstractNumberFormatterTest extends TestCase
public function testParseTypeCurrency() public function testParseTypeCurrency()
{ {
$this->expectException(Warning::class); if (method_exists($this, 'expectWarning')) {
$this->expectWarning();
} else {
$this->expectException(Warning::class);
}
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY); $formatter->parse('1', NumberFormatter::TYPE_CURRENCY);