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


PHP Intl::getIcuStubVersion方法代码示例

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


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

示例1: requireIntl

 /**
  * Should be called before tests that work fine with the stub implementation.
  */
 public static function requireIntl(\PHPUnit_Framework_TestCase $testCase, $minimumIcuVersion = null)
 {
     if (null === $minimumIcuVersion) {
         $minimumIcuVersion = Intl::getIcuStubVersion();
     }
     // We only run tests if the version is *one specific version*.
     // This condition is satisfied if
     //
     //   * the intl extension is loaded with version Intl::getIcuStubVersion()
     //   * the intl extension is not loaded
     if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '!=', 1)) {
         $testCase->markTestSkipped('ICU version ' . $minimumIcuVersion . ' is required.');
     }
     // Normalize the default locale in case this is not done explicitly
     // in the test
     \Locale::setDefault('en');
     // Consequently, tests will
     //
     //   * run only for one ICU version (see Intl::getIcuStubVersion())
     //     there is no need to add control structures to your tests that
     //     change the test depending on the ICU version.
     //
     // Tests should only rely on functionality that is implemented in the
     // stub classes.
 }
开发者ID:yceruto,项目名称:symfony,代码行数:28,代码来源:IntlTestHelper.php

示例2: requireFullIntl

 /**
  * Should be called before tests that require a feature-complete intl
  * implementation.
  *
  * @param \PhpUnit_Framework_TestCase $testCase
  */
 public static function requireFullIntl(\PhpUnit_Framework_TestCase $testCase)
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $testCase->markTestSkipped('The intl extension is not available.');
     }
     // ... and only if the version is *one specific version* ...
     if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
         $testCase->markTestSkipped('Please change ICU version to ' . Intl::getIcuStubVersion());
     }
     // ... and only if the data in the Icu component matches that version.
     if (IcuVersion::compare(Intl::getIcuDataVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
         $testCase->markTestSkipped('Please change the Icu component to version 1.0.x or 1.' . IcuVersion::normalize(Intl::getIcuStubVersion(), 1) . '.x');
     }
     // Normalize the default locale in case this is not done explicitly
     // in the test
     \Locale::setDefault('en');
     // Consequently, tests will
     //
     //   * run only for one ICU version (see Intl::getIcuStubVersion())
     //     there is no need to add control structures to your tests that
     //     change the test depending on the ICU version.
     //   * always use the C intl classes
     //   * always use the binary resource bundles (any locale is allowed)
 }
开发者ID:bonett23,项目名称:pruebaTweetsSymfony2Hely,代码行数:31,代码来源:IntlTestHelper.php

示例3: requireFullIntl

 /**
  * Should be called before tests that require a feature-complete intl
  * implementation.
  *
  * @param \PhpUnit_Framework_TestCase $testCase
  */
 public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase)
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $testCase->markTestSkipped('Extension intl is required.');
     }
     // ... and only if the version is *one specific version*
     if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', 1)) {
         $testCase->markTestSkipped('ICU version ' . Intl::getIcuStubVersion() . ' is required.');
     }
     // Normalize the default locale in case this is not done explicitly
     // in the test
     \Locale::setDefault('en');
     // Consequently, tests will
     //
     //   * run only for one ICU version (see Intl::getIcuStubVersion())
     //     there is no need to add control structures to your tests that
     //     change the test depending on the ICU version.
     //   * always use the C intl classes
 }
开发者ID:unexge,项目名称:symfony,代码行数:26,代码来源:IntlTestHelper.php

示例4: centered

}
echo LINE;
echo centered("ICU Resource Bundle Stub Creation") . "\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}
if (!class_exists('\\Symfony\\Component\\Icu\\IcuData')) {
    bailout('You must run "composer update --dev" before running this script.');
}
$stubBranch = '1.0.x';
if (IcuData::isStubbed()) {
    bailout("Please switch to a branch of the Icu component that contains .res files (anything but {$stubBranch}).");
}
$shortIcuVersionInPhp = strip_minor_versions(Intl::getIcuVersion());
$shortIcuVersionInIntlComponent = strip_minor_versions(Intl::getIcuStubVersion());
$shortIcuVersionInIcuComponent = strip_minor_versions(IcuData::getVersion());
if ($shortIcuVersionInPhp !== $shortIcuVersionInIcuComponent) {
    bailout("The ICU version of the component ({$shortIcuVersionInIcuComponent}) does not match the ICU version in the intl extension ({$shortIcuVersionInPhp}).");
}
if ($shortIcuVersionInIntlComponent !== $shortIcuVersionInIcuComponent) {
    bailout("The ICU version of the component ({$shortIcuVersionInIcuComponent}) does not match the ICU version of the stub classes in the Intl component ({$shortIcuVersionInIntlComponent}).");
}
echo wordwrap("Make sure that you don't have any ICU development files " . "installed. If the build fails, try to run:\n", LINE_WIDTH);
echo "\n    sudo apt-get remove libicu-dev\n\n";
$icuVersionInIcuComponent = IcuData::getVersion();
echo "Compiling stubs for ICU version {$icuVersionInIcuComponent}.\n";
echo "Preparing stub creation...\n";
$targetDir = sys_get_temp_dir() . '/icu-stubs';
$context = new StubbingContext(IcuData::getResourceDirectory(), $targetDir, new Filesystem(), $icuVersionInIcuComponent);
$transformer = new BundleTransformer();
开发者ID:TuxCoffeeCorner,项目名称:tcc,代码行数:31,代码来源:create-stubs.php


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