예제 #1
0
use Symfony\Component\Intl\Intl;
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/autoload.php';
if (1 !== $GLOBALS['argc']) {
    bailout(<<<MESSAGE
Usage: php test-compat.php

Tests the compatibility of the current ICU version (bundled in ext/intl) with
different versions of symfony/icu.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

    composer install --dev

MESSAGE
);
}
echo LINE;
echo centered("ICU Compatibility Test") . "\n";
echo LINE;
echo "Your ICU version: " . Intl::getIcuVersion() . "\n";
echo "Compatibility with symfony/icu:\n";
$branches = array('1.1.x', '1.2.x');
cd(__DIR__ . '/../../vendor/symfony/icu/Symfony/Component/Icu');
foreach ($branches as $branch) {
    run('git checkout ' . $branch . ' 2>&1');
    exec('php ' . __DIR__ . '/util/test-compat-helper.php > /dev/null 2> /dev/null', $output, $status);
    echo "{$branch}: " . (0 === $status ? "YES" : "NO") . "\n";
}
echo "Done.\n";
예제 #2
0
repository source in the first optional argument.

If you also built the repository before, you can pass the directory where that
build is stored in the second parameter. The build directory needs to contain
the subdirectories bin/ and lib/.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

composer install

MESSAGE
);
}
echo LINE;
echo centered('ICU Resource Bundle Compilation') . "\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}
$filesystem = new Filesystem();
$urls = parse_ini_file(__DIR__ . '/icu.ini');
echo "icu.ini parsed. Available versions:\n";
$maxVersion = 0;
foreach ($urls as $urlVersion => $url) {
    $maxVersion = IcuVersion::compare($maxVersion, $urlVersion, '<') ? $urlVersion : $maxVersion;
    echo "  {$urlVersion}\n";
}
$shortIcuVersion = strip_minor_versions($maxVersion);
if ($argc >= 2) {
    $sourceDir = $argv[1];
예제 #3
0
repository source in the first optional argument.

If you also built the repository before, you can pass the directory where that
build is stored in the second parameter. The build directory needs to contain
the subdirectories bin/ and lib/.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

    composer install --dev

MESSAGE
);
}
echo LINE;
echo centered("ICU Resource Bundle Compilation") . "\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.');
}
$filesystem = new Filesystem();
$icuVersionInPhp = Intl::getIcuVersion();
echo "Found intl extension with ICU version {$icuVersionInPhp}.\n";
$shortIcuVersion = strip_minor_versions($icuVersionInPhp);
$urls = parse_ini_file(__DIR__ . '/icu.ini');
if (!isset($urls[$shortIcuVersion])) {
    bailout('The version ' . $shortIcuVersion . ' is not available in the icu.ini file.');
}
예제 #4
0
if (1 !== $GLOBALS['argc']) {
    bailout(<<<MESSAGE
Usage: php create-stubs.php

Creates resource bundle stubs from the resource bundles in the Icu component.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

    composer install --dev

MESSAGE
);
}
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) {
if (1 !== $GLOBALS['argc']) {
    bailout(<<<MESSAGE
Usage: php copy-stubs-to-component.php

Copies stub files created with create-stubs.php to the Icu component.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

    composer install --dev

MESSAGE
);
}
echo LINE;
echo centered("ICU Resource Bundle Stub Update") . "\n";
echo LINE;
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 the Icu component branch {$stubBranch}.");
}
$filesystem = new Filesystem();
$sourceDir = sys_get_temp_dir() . '/icu-stubs';
$targetDir = IcuData::getResourceDirectory();
if (!$filesystem->exists($sourceDir)) {
    bailout("The directory {$sourceDir} does not exist. Please run create-stubs.php first.");
}
$filesystem->remove($targetDir);