php Symfony-Component-Intl-Util-IntlTestHelper类(方法)实例源码

下面列出了php Symfony-Component-Intl-Util-IntlTestHelper 类(方法)源码代码实例,从而了解它的用法。

作者:xingshangh    项目:symfon   
protected function setUp()
 {
     // we test against different locales, so we need the full
     // implementation
     IntlTestHelper::requireFullIntl($this);
     parent::setUp();
 }

作者:tahermarko    项目:Transpor   
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');
 }

作者:Dren-    项目:mobi   
/**
  * @dataProvider getValidCurrencies
  **/
 public function testValidCurrenciesWithCountrySpecificLocale($currency)
 {
     IntlTestHelper::requireFullIntl($this);
     \Locale::setDefault('en_GB');
     $this->validator->validate($currency, new Currency());
     $this->assertNoViolation();
 }

作者:xingshangh    项目:symfon   
protected function setUp()
 {
     parent::setUp();
     // we test against "de_DE", so we need the full implementation
     IntlTestHelper::requireFullIntl($this);
     \Locale::setDefault('de_DE');
 }

作者:Nival    项目:VacantesJannaMotor   
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);
 }

作者:d3ancole199    项目:symfon   
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'));
 }

作者:VincentMardo    项目:Links_lis   
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();
 }

作者:ycerut    项目:symfon   
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;
 }

作者:ycerut    项目:symfon   
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'));
 }

作者:Dren-    项目:mobi   
public function testValidateUsingCountrySpecificLocale()
 {
     IntlTestHelper::requireFullIntl($this);
     \Locale::setDefault('fr_FR');
     $existingLanguage = 'en';
     $this->validator->validate($existingLanguage, new Language(array('message' => 'aMessage')));
     $this->assertNoViolation();
 }

作者:Ener-Getic    项目:symfon   
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');
 }

作者:ayoa    项目:symfon   
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();
 }

作者:brookinsconsultin    项目:ezecosyste   
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());
 }

作者:Maksol    项目:platfor   
/**
  * @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));
 }

作者:BusinessCookie    项目:CoffeeMachineProjec   
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());
 }

作者:d3ancole199    项目:symfon   
public function testReverseTransformWithGrouping()
 {
     // Since we test against "de_AT", we need the full implementation
     IntlTestHelper::requireFullIntl($this);
     \Locale::setDefault('de_AT');
     $transformer = new IntegerToLocalizedStringTransformer(null, true);
     $this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));
     $this->assertEquals(12345, $transformer->reverseTransform('12.345,912'));
     $this->assertEquals(1234, $transformer->reverseTransform('1234,5'));
     $this->assertEquals(12345, $transformer->reverseTransform('12345,912'));
 }

作者:raphael-thibierg    项目:ProgWebServerProjec   
/**
  * @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));
 }

作者:d3ancole199    项目:symfon   
/**
  * @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();
 }

作者:ycerut    项目:symfon   
protected function setUp()
 {
     IntlTestHelper::requireFullIntl($this, false);
     parent::setUp();
 }

作者:ycerut    项目:symfon   
public function testGetTextAttribute()
 {
     IntlTestHelper::requireFullIntl($this);
     parent::testGetTextAttribute();
 }


问题


面经


文章

微信
公众号

扫码关注公众号