本文整理汇总了PHP中Symfony\Component\Intl\Util\IntlTestHelper类的典型用法代码示例。如果您正苦于以下问题:PHP IntlTestHelper类的具体用法?PHP IntlTestHelper怎么用?PHP IntlTestHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntlTestHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
// we test against different locales, so we need the full
// implementation
IntlTestHelper::requireFullIntl($this);
parent::setUp();
}
示例2: testWriteResourceBundle
public function testWriteResourceBundle()
{
IntlTestHelper::requireFullIntl($this);
$bundle = new \ResourceBundle('rb', __DIR__ . '/Fixtures', false);
$this->writer->write($this->directory, 'en', $bundle);
$this->assertFileEquals(__DIR__ . '/Fixtures/rb.php', $this->directory . '/en.php');
}
示例3: testValidCurrenciesWithCountrySpecificLocale
/**
* @dataProvider getValidCurrencies
**/
public function testValidCurrenciesWithCountrySpecificLocale($currency)
{
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('en_GB');
$this->validator->validate($currency, new Currency());
$this->assertNoViolation();
}
示例4: setUp
protected function setUp()
{
parent::setUp();
// we test against "de_DE", so we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_DE');
}
示例5: setUp
protected function setUp()
{
IntlTestHelper::requireFullIntl($this);
$this->context = $this->getMock('Symfony\\Component\\Validator\\ExecutionContext', array(), array(), '', false);
$this->validator = new CurrencyValidator();
$this->validator->initialize($this->context);
}
示例6: testReverseTransformWithPrecision
public function testReverseTransformWithPrecision()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$transformer = new PercentToLocalizedStringTransformer(2);
$this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));
}
示例7: setUp
protected function setUp()
{
parent::setUp();
// we test against "de_AT", so we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$this->defaultTimezone = date_default_timezone_get();
}
示例8: getDateFormatter
protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null)
{
IntlTestHelper::requireFullIntl($this, '55.1');
if (!($formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern))) {
throw new \InvalidArgumentException(intl_get_error_message());
}
return $formatter;
}
示例9: testReverseTransform
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
$this->assertEquals(123, $transformer->reverseTransform('1,23'));
}
示例10: testValidateUsingCountrySpecificLocale
public function testValidateUsingCountrySpecificLocale()
{
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('fr_FR');
$existingLanguage = 'en';
$this->validator->validate($existingLanguage, new Language(array('message' => 'aMessage')));
$this->assertNoViolation();
}
示例11: setUp
protected function setUp()
{
parent::setUp();
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('de_AT');
$this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC');
$this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
}
示例12: testValidateUsingCountrySpecificLocale
public function testValidateUsingCountrySpecificLocale()
{
// in order to test with "en_GB"
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('en_GB');
$existingCountry = 'GB';
$this->validator->validate($existingCountry, new Country());
$this->assertNoViolation();
}
示例13: testValidateUsingCountrySpecificLocale
public function testValidateUsingCountrySpecificLocale()
{
// in order to test with "en_GB"
IntlTestHelper::requireFullIntl($this);
\Locale::setDefault('en_GB');
$existingCountry = 'GB';
$this->context->expects($this->never())->method('addViolation');
$this->validator->validate($existingCountry, new Country());
}
示例14: testBuildForm
/**
* @dataProvider buildFormProvider
*
* @param array $configData
* @param string $defaultLang
* @param array $choicesKeysExpected
*/
public function testBuildForm(array $configData, $defaultLang, array $choicesKeysExpected)
{
IntlTestHelper::requireIntl($this);
\Locale::setDefault($defaultLang);
$this->cmMock->expects($this->at(0))->method('get')->with($this->equalTo(LanguageType::CONFIG_KEY), $this->equalTo(true))->will($this->returnValue($defaultLang));
$this->cmMock->expects($this->at(1))->method('get')->with($this->equalTo(TranslationStatusInterface::CONFIG_KEY))->will($this->returnValue($configData));
$form = $this->factory->create($this->formType);
$choices = $form->getConfig()->getOption('choices');
$this->assertEquals($choicesKeysExpected, array_keys($choices));
}
示例15: testGetLocaleReturnsDefaultLocaleIfNotSet
public function testGetLocaleReturnsDefaultLocaleIfNotSet()
{
// in order to test with "pt_BR"
IntlTestHelper::requireFullIntl($this);
$translator = new IdentityTranslator();
\Locale::setDefault('en');
$this->assertEquals('en', $translator->getLocale());
\Locale::setDefault('pt_BR');
$this->assertEquals('pt_BR', $translator->getLocale());
}