From 71e2dcc6d5486a8fbc5ac3a416bec145b857d873 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 17 Oct 2013 01:53:32 +0400 Subject: [PATCH] Better MessageFormatter tests --- tests/unit/framework/i18n/MessageFormatterTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/unit/framework/i18n/MessageFormatterTest.php b/tests/unit/framework/i18n/MessageFormatterTest.php index e65e3e9..caffffe 100644 --- a/tests/unit/framework/i18n/MessageFormatterTest.php +++ b/tests/unit/framework/i18n/MessageFormatterTest.php @@ -142,11 +142,18 @@ _MSG_ } /** - * when instantiating a MessageFormatter with invalid pattern it should be null + * When instantiating a MessageFormatter with invalid pattern it should be null with default settings. + * It will be IntlException if intl.use_exceptions=1 and PHP 5.5 or newer or an error if intl.error_level is not 0. */ public function testNullConstructor() { - $this->assertNull(new MessageFormatter('en_US', '')); + if(ini_get('intl.use_exceptions')) { + $this->setExpectedException('IntlException'); + } + + if (!ini_get('intl.error_level') || ini_get('intl.use_exceptions')) { + $this->assertNull(new MessageFormatter('en_US', '')); + } } public function testNoParams()