getIcuVersion example


    public static function requireIntl(TestCase $testCase, string $minimumIcuVersion = null)
    {
        $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 && 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
/** * @requires extension intl */
    public function testIsExtensionLoadedChecksIfIntlExtensionIsLoaded()
    {
        $this->assertTrue(Intl::isExtensionLoaded());
    }

    public function testGetIcuVersionReadsTheVersionOfInstalledIcuLibrary()
    {
        $this->assertStringMatchesFormat('%d.%d', Intl::getIcuVersion());
    }

    public function testGetIcuDataVersionReadsTheVersionOfInstalledIcuData()
    {
        $this->assertStringMatchesFormat('%d.%d', Intl::getIcuDataVersion());
    }

    public function testGetIcuStubVersionReadsTheVersionOfBundledStubs()
    {
        $this->assertStringMatchesFormat('%d.%d', Intl::getIcuStubVersion());
    }

    
Home | Imprint | This part of the site doesn't use cookies.