Check that class exists

main
Lars Strojny 4 years ago
parent 404dea61c2
commit 5a02ea6a96
No known key found for this signature in database
GPG Key ID: 887416A2AD3B0CA9

@ -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';

@ -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();

Loading…
Cancel
Save