Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4:
  Mutate remaining data providers to static ones
  • Loading branch information
derrabus committed Sep 20, 2024
2 parents c766246 + e4171a0 commit ad84190
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 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
20 changes: 10 additions & 10 deletions Tests/ResourceBundleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,45 +758,45 @@ protected function tearDown(): void
\Locale::setDefault($this->defaultLocale);
}

public function provideLocales()
public static function provideLocales()
{
return array_map(
fn ($locale) => [$locale],
$this->getLocales()
static::getLocales()
);
}

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

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

protected function getLocales()
protected static function getLocales()
{
return self::LOCALES;
}

protected function getLocaleAliases()
protected static function getLocaleAliases()
{
return self::LOCALE_ALIASES;
}

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

Expand Down

0 comments on commit ad84190

Please sign in to comment.