當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。