本文整理汇总了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);
}
示例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));
}
示例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();
}
示例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();
}
示例6: setUp
protected function setUp()
{
IntlTestHelper::requireIntl($this);
parent::setUp();
}
示例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);
}
}
示例8: setUp
protected function setUp()
{
// Locale extends \Locale, so intl must be present
IntlTestHelper::requireIntl($this);
}
示例9: setUp
protected function setUp()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
// Locale extends \Locale, so intl must be present
IntlTestHelper::requireIntl($this);
}
示例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'));
}
示例11: setUp
protected function setUp()
{
IntlTestHelper::requireIntl($this);
parent::setUp();
$this->defaultTimezone = date_default_timezone_get();
}