1
0
Fork 0

Check that class exists

pull/9085/head
Lars Strojny 2020-07-30 14:29:48 +02:00
parent 404dea61c2
commit 5a02ea6a96
No known key found for this signature in database
GPG Key ID: 887416A2AD3B0CA9
2 changed files with 10 additions and 5 deletions

View File

@ -154,9 +154,11 @@ class PlatformRepository extends ArrayRepository
break;
case 'intl':
# Add a seperate version for the CLDR library version
$cldrVersion = \ResourceBundle::create('root', 'ICUDATA-curr', false)->get('Version');
$this->addLibrary('cldr', 'The unicode CLDR project', $cldrVersion);
if (class_exists('ResourceBundle', false)) {
# Add a seperate version for the CLDR library version
$cldrVersion = \ResourceBundle::create('root', 'ICUDATA-curr', false)->get('Version');
$this->addLibrary('cldr', 'The unicode CLDR project', $cldrVersion);
}
$name = 'icu';
$description = 'The ICU unicode and globalization support library';

View File

@ -69,12 +69,15 @@ class PlatformRepositoryTest extends TestCase {
$this->assertSame('4.0.1.0-dev', $package->getVersion());
}
public function testICULibraryVersion()
{
public function testICULibraryVersion() {
if (!defined('INTL_ICU_VERSION')) {
$this->markTestSkipped('Test only work with ext-intl present');
}
if (!class_exists('ResourceBundle', false)) {
$this->markTestSkipped('Test only work with ResourceBundle class present');
}
$platformRepository = new PlatformRepository();
$packages = $platformRepository->getPackages();