From 3dd75ff843709444c68b2596e3907b0f90f22405 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Sat, 16 Mar 2013 01:38:31 +0100 Subject: [PATCH] [Locale] Improved tests to use the IntlTestHelper class --- src/Symfony/Component/Locale/Tests/LocaleTest.php | 14 ++++---------- .../Component/Locale/Tests/Stub/StubLocaleTest.php | 3 +++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Locale/Tests/LocaleTest.php b/src/Symfony/Component/Locale/Tests/LocaleTest.php index 71c5ba2da9..d11c826c48 100644 --- a/src/Symfony/Component/Locale/Tests/LocaleTest.php +++ b/src/Symfony/Component/Locale/Tests/LocaleTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Locale\Tests; use Symfony\Component\Intl\Intl; -use Symfony\Component\Intl\Tests\IntlTestCase; use Symfony\Component\Intl\Util\IcuVersion; +use Symfony\Component\Intl\Util\IntlTestHelper; use Symfony\Component\Locale\Locale; /** @@ -21,18 +21,12 @@ use Symfony\Component\Locale\Locale; * * @author Bernhard Schussek */ -class LocaleTest extends IntlTestCase +class LocaleTest extends \PHPUnit_Framework_TestCase { protected function setUp() { - // This class extends from \Ļocale, so we need the extension - if (!Intl::isExtensionLoaded()) { - $this->markTestSkipped('The intl extension is not available.'); - } - - Intl::setDataSource(Intl::STUB); - - Locale::setDefault('en'); + // Locale extends \Locale, so intl must be present + IntlTestHelper::requireIntl($this); } public function testGetDisplayCountries() diff --git a/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php b/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php index aebd576838..7e5f64cf12 100644 --- a/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php +++ b/src/Symfony/Component/Locale/Tests/Stub/StubLocaleTest.php @@ -22,7 +22,10 @@ class StubLocaleTest extends \PHPUnit_Framework_TestCase { protected function setUp() { + // Force the use of stub data to have consistent results Intl::setDataSource(Intl::STUB); + + parent::setUp(); } public function testGetCurrenciesData()