Skip to content

Commit

Permalink
Merge branch '6.4' into 7.1
Browse files Browse the repository at this point in the history
* 6.4:
  Make more data providers static
  fix merge
  Mutate remaining data providers to static ones
  • Loading branch information
derrabus committed Sep 20, 2024
2 parents da60d7f + 5f64d72 commit a0ba7a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Tests/LocalesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class LocalesTest extends ResourceBundleTestCase
{
public function testGetLocales()
{
$this->assertSame($this->getLocales(), Locales::getLocales());
$this->assertSame(static::getLocales(), Locales::getLocales());
}

public function testGetAliases()
{
$this->assertSame($this->getLocaleAliases(), Locales::getAliases());
$this->assertSame(static::getLocaleAliases(), Locales::getAliases());
}

/**
Expand All @@ -41,7 +41,7 @@ public function testGetNames($displayLocale)
// We can't assert on exact list of locale, as there's too many variations.
// The best we can do is to make sure getNames() returns a subset of what getLocales() returns.
$this->assertNotEmpty($locales);
$this->assertEmpty(array_diff($locales, $this->getLocales()));
$this->assertEmpty(array_diff($locales, static::getLocales()));
}

public function testGetNamesDefaultLocale()
Expand Down
12 changes: 6 additions & 6 deletions Tests/ResourceBundleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,24 +762,24 @@ public static function provideLocales()
{
return array_map(
fn ($locale) => [$locale],
self::getLocales()
static::getLocales()
);
}

public static function provideLocaleAliases()
{
return array_map(
fn ($alias, $ofLocale) => [$alias, $ofLocale],
array_keys(self::getLocaleAliases()),
self::getLocaleAliases()
array_keys(static::getLocaleAliases()),
static::getLocaleAliases()
);
}

public static function provideRootLocales()
{
return array_map(
fn ($locale) => [$locale],
self::getRootLocales()
static::getRootLocales()
);
}

Expand All @@ -796,8 +796,8 @@ protected static function getLocaleAliases()
protected static function getRootLocales()
{
if (null === self::$rootLocales) {
// ignore locales for which fallback is possible (e.g "en_GB")
self::$rootLocales = array_filter(self::getLocales(), fn ($locale) => !str_contains($locale, '_'));
// no locales for which fallback is possible (e.g "en_GB")
self::$rootLocales = array_filter(static::getLocales(), fn ($locale) => !str_contains($locale, '_'));
}

return self::$rootLocales;
Expand Down

0 comments on commit a0ba7a4

Please sign in to comment.