Skip to content

Commit e4171a0

Browse files
Mutate remaining data providers to static ones
1 parent 03e87f2 commit e4171a0

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

Tests/LocalesTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class LocalesTest extends ResourceBundleTestCase
2121
{
2222
public function testGetLocales()
2323
{
24-
$this->assertSame($this->getLocales(), Locales::getLocales());
24+
$this->assertSame(static::getLocales(), Locales::getLocales());
2525
}
2626

2727
public function testGetAliases()
2828
{
29-
$this->assertSame($this->getLocaleAliases(), Locales::getAliases());
29+
$this->assertSame(static::getLocaleAliases(), Locales::getAliases());
3030
}
3131

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

4747
public function testGetNamesDefaultLocale()

Tests/ResourceBundleTestCase.php

+9-17
Original file line numberDiff line numberDiff line change
@@ -758,45 +758,37 @@ protected function tearDown(): void
758758
\Locale::setDefault($this->defaultLocale);
759759
}
760760

761-
public function provideLocales()
761+
public static function provideLocales()
762762
{
763763
return array_map(
764764
function ($locale) { return [$locale]; },
765-
$this->getLocales()
765+
static::getLocales()
766766
);
767767
}
768768

769-
public function provideLocaleAliases()
769+
public static function provideLocaleAliases()
770770
{
771771
return array_map(
772772
function ($alias, $ofLocale) { return [$alias, $ofLocale]; },
773-
array_keys($this->getLocaleAliases()),
774-
$this->getLocaleAliases()
773+
array_keys(static::getLocaleAliases()),
774+
static::getLocaleAliases()
775775
);
776776
}
777777

778-
public function provideRootLocales()
779-
{
780-
return array_map(
781-
function ($locale) { return [$locale]; },
782-
$this->getRootLocales()
783-
);
784-
}
785-
786-
protected function getLocales()
778+
protected static function getLocales()
787779
{
788780
return self::LOCALES;
789781
}
790782

791-
protected function getLocaleAliases()
783+
protected static function getLocaleAliases()
792784
{
793785
return self::LOCALE_ALIASES;
794786
}
795787

796-
protected function getRootLocales()
788+
protected static function getRootLocales()
797789
{
798790
if (null === self::$rootLocales) {
799-
self::$rootLocales = array_filter($this->getLocales(), function ($locale) {
791+
self::$rootLocales = array_filter(static::getLocales(), function ($locale) {
800792
// no locales for which fallback is possible (e.g "en_GB")
801793
return !str_contains($locale, '_');
802794
});

0 commit comments

Comments
 (0)