当前位置: 首页>>代码示例>>PHP>>正文


PHP IntlTestHelper::requireIntl方法代码示例

本文整理汇总了PHP中Symfony\Component\Intl\Util\IntlTestHelper::requireIntl方法的典型用法代码示例。如果您正苦于以下问题:PHP IntlTestHelper::requireIntl方法的具体用法?PHP IntlTestHelper::requireIntl怎么用?PHP IntlTestHelper::requireIntl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Intl\Util\IntlTestHelper的用法示例。


在下文中一共展示了IntlTestHelper::requireIntl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     IntlTestHelper::requireIntl($this);
     $this->context = $this->getMock('Symfony\\Component\\Validator\\ExecutionContext', array(), array(), '', false);
     $this->validator = new CurrencyValidator();
     $this->validator->initialize($this->context);
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:CurrencyValidatorTest.php

示例2: 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));
 }
开发者ID:Maksold,项目名称:platform,代码行数:17,代码来源:LanguageTypeTest.php

示例3: testInvalidComparisonToValue

 /**
  * @dataProvider provideInvalidComparisons
  * @param mixed  $dirtyValue
  * @param mixed  $dirtyValueAsString
  * @param mixed  $comparedValue
  * @param mixed  $comparedValueString
  * @param string $comparedValueType
  */
 public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType)
 {
     // Conversion of dates to string differs between ICU versions
     // Make sure we have the correct version loaded
     if ($dirtyValue instanceof \DateTime) {
         IntlTestHelper::requireIntl($this);
     }
     $constraint = $this->createConstraint(array('value' => $comparedValue));
     $constraint->message = 'Constraint Message';
     $this->validator->validate($dirtyValue, $constraint);
     $this->assertViolation('Constraint Message', array('{{ value }}' => $dirtyValueAsString, '{{ compared_value }}' => $comparedValueString, '{{ compared_value_type }}' => $comparedValueType));
 }
开发者ID:raphael-thibierge,项目名称:ProgWebServerProject,代码行数:20,代码来源:AbstractComparisonValidatorTestCase.php

示例4: testInvalidComparisonToValue

 /**
  * @dataProvider provideInvalidComparisons
  *
  * @param mixed  $dirtyValue
  * @param mixed  $dirtyValueAsString
  * @param mixed  $comparedValue
  * @param mixed  $comparedValueString
  * @param string $comparedValueType
  */
 public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType)
 {
     // Conversion of dates to string differs between ICU versions
     // Make sure we have the correct version loaded
     if ($dirtyValue instanceof \DateTime) {
         IntlTestHelper::requireIntl($this);
         if (PHP_VERSION_ID < 50304 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
             $this->markTestSkipped('Intl supports formatting DateTime objects since 5.3.4');
         }
     }
     $constraint = $this->createConstraint(array('value' => $comparedValue));
     $constraint->message = 'Constraint Message';
     $this->validator->validate($dirtyValue, $constraint);
     $this->buildViolation('Constraint Message')->setParameter('{{ value }}', $dirtyValueAsString)->setParameter('{{ compared_value }}', $comparedValueString)->setParameter('{{ compared_value_type }}', $comparedValueType)->assertRaised();
 }
开发者ID:d3ancole1995,项目名称:symfony,代码行数:24,代码来源:AbstractComparisonValidatorTestCase.php

示例5: testInvalidDatesCombinedMin

 /**
  * @dataProvider getSoonerThanTenthMarch2014
  */
 public function testInvalidDatesCombinedMin($value, $dateTimeAsString)
 {
     // Conversion of dates to string differs between ICU versions
     // Make sure we have the correct version loaded
     IntlTestHelper::requireIntl($this);
     $constraint = new Range(array('min' => 'March 10, 2014', 'max' => 'March 20, 2014', 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage'));
     $this->validator->validate($value, $constraint);
     $this->buildViolation('myMinMessage')->setParameter('{{ value }}', $dateTimeAsString)->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM')->setCode(Range::BELOW_RANGE_ERROR)->assertRaised();
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:12,代码来源:RangeValidatorTest.php

示例6: setUp

 protected function setUp()
 {
     IntlTestHelper::requireIntl($this);
     parent::setUp();
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:5,代码来源:CurrencyTypeTest.php

示例7: testCountryChoiceChoices

 /**
  * @dataProvider countryChoiceChoicesProvider
  */
 public function testCountryChoiceChoices(array $choices, $expectedChoicesCount, array $expectedChoices)
 {
     IntlTestHelper::requireIntl($this);
     if (method_exists('Symfony\\Component\\Form\\FormTypeInterface', 'getName')) {
         $type = new PhoneNumberType();
     } else {
         $type = 'Misd\\PhoneNumberBundle\\Form\\Type\\PhoneNumberType';
     }
     $form = $this->factory->create($type, null, array('widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE, 'country_choices' => $choices));
     $view = $form->createView();
     $choices = $view['country']->vars['choices'];
     $this->assertCount($expectedChoicesCount, $choices);
     foreach ($expectedChoices as $expectedChoice) {
         $this->assertContains($expectedChoice, $choices, '', false, false);
     }
 }
开发者ID:clavier-souris,项目名称:phone-number-bundle,代码行数:19,代码来源:PhoneNumberTypeTest.php

示例8: setUp

 protected function setUp()
 {
     // Locale extends \Locale, so intl must be present
     IntlTestHelper::requireIntl($this);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:5,代码来源:StubLocaleTest.php

示例9: setUp

 protected function setUp()
 {
     $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
     // Locale extends \Locale, so intl must be present
     IntlTestHelper::requireIntl($this);
 }
开发者ID:RuntyCybin,项目名称:csymfony,代码行数:6,代码来源:LocaleTest.php

示例10: testInvalidDatesCombinedMin

 /**
  * @dataProvider getSoonerThanTenthMarch2014
  */
 public function testInvalidDatesCombinedMin($value)
 {
     // Conversion of dates to string differs between ICU versions
     // Make sure we have the correct version loaded
     IntlTestHelper::requireIntl($this);
     $constraint = new Range(array('min' => 'March 10, 2014', 'max' => 'March 20, 2014', 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage'));
     $this->validator->validate($value, $constraint);
     $this->assertViolation('myMinMessage', array('{{ value }}' => $value, '{{ limit }}' => 'Mar 10, 2014, 12:00 AM'));
 }
开发者ID:alexbogo,项目名称:symfony,代码行数:12,代码来源:RangeValidatorTest.php

示例11: setUp

 protected function setUp()
 {
     IntlTestHelper::requireIntl($this);
     parent::setUp();
     $this->defaultTimezone = date_default_timezone_get();
 }
开发者ID:neagu-cristian,项目名称:Jobeet,代码行数:6,代码来源:TimeTypeTest.php


注:本文中的Symfony\Component\Intl\Util\IntlTestHelper::requireIntl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。