Skip to content

Commit

Permalink
use setExpectedException() instead of annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
antograssiot committed Jun 8, 2015
1 parent 295ce50 commit 201851d
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions tests/TestCase/I18n/Formatter/IcuFormatterTest.php
Expand Up @@ -95,27 +95,22 @@ public function testNativePluralSelection()
/**
* Tests that passing a message in the wrong format will throw an exception
*
* @expectedException Exception
* @expectedExceptionMessage msgfmt_create: message formatter
* @return void
*/
public function testBadMessageFormat()
{
$this->skipIf(version_compare(PHP_VERSION, '7', '>='), 'Skiped for PHP 7 as MessageFormatter throws a different exception');
$formatter = new IcuFormatter();
$formatter->format('en_US', '{crazy format', ['some', 'vars']);
}
if (version_compare(PHP_VERSION, '7', '<')) {
$this->setExpectedException(
'Exception',
'msgfmt_create: message formatter'
);
} else {
$this->setExpectedException(
'Exception',
'Constructor failed'
);
}

/**
* Tests that passing a message in the wrong format will throw an exception
*
* @expectedException Exception
* @expectedExceptionMessage Constructor failed
* @return void
*/
public function testBadMessageFormatPHP7()
{
$this->skipIf(version_compare(PHP_VERSION, '7', '<'), 'Skiped for PHP 5.x as MessageFormatter throws a different exception');
$formatter = new IcuFormatter();
$formatter->format('en_US', '{crazy format', ['some', 'vars']);
}
Expand Down

0 comments on commit 201851d

Please sign in to comment.