minor #37828 use expectWarning() when possible (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

use expectWarning() when possible

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

26dd39eb06 use expectWarning() when possible
This commit is contained in:
Fabien Potencier 2020-08-13 16:35:54 +02:00
commit 30d8496921

View File

@ -324,7 +324,11 @@ abstract class AbstractNumberFormatterTest extends TestCase
*/
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);
}
@ -701,7 +705,11 @@ abstract class AbstractNumberFormatterTest extends TestCase
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->parse('1', NumberFormatter::TYPE_DEFAULT);
@ -821,7 +829,11 @@ abstract class AbstractNumberFormatterTest extends TestCase
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->parse('1', NumberFormatter::TYPE_CURRENCY);