diff --git a/tests/Localisations/BaseLocalisationCase.php b/tests/Localisations/BaseLocalisationCase.php index 908bd6ae7..b95b606cc 100644 --- a/tests/Localisations/BaseLocalisationCase.php +++ b/tests/Localisations/BaseLocalisationCase.php @@ -2,18 +2,18 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Localisations; +use PHPUnit\Framework\Attributes\DataProvider; use Rappasoft\LaravelLivewireTables\Tests\Models\Pet; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -use PHPUnit\Framework\Attributes\DataProvider; class BaseLocalisationCase extends TestCase { - public static function getEnLocaleStrings(): array { $baseDir = __DIR__.'/../../resources/lang/'; - $items = require($baseDir."en/core.php"); + $items = require $baseDir.'en/core.php'; + return $items; } @@ -21,7 +21,8 @@ public static function getLocaleStrings($locale): array { $baseDir = __DIR__.'/../../resources/lang/'; - $items = require($baseDir.$locale."/core.php"); + $items = require $baseDir.$locale.'/core.php'; + return $items; } @@ -58,15 +59,14 @@ public static function localisationProvider(): array ]; //return $availableLocales; - foreach ($availableLocales as $availableLocale) - { + foreach ($availableLocales as $availableLocale) { //$array = require($baseDir.$availableLocale.'/core.php'); $localisations[] = [ - 'locale' => $availableLocale, - // 'localisationStrings' => $array, + 'locale' => $availableLocale, + // 'localisationStrings' => $array, ]; } + return $localisations; } - -} \ No newline at end of file +} diff --git a/tests/Localisations/Presence/CheckKeyPresenceTest.php b/tests/Localisations/Presence/CheckKeyPresenceTest.php index ba4d43fb7..46aedc84e 100644 --- a/tests/Localisations/Presence/CheckKeyPresenceTest.php +++ b/tests/Localisations/Presence/CheckKeyPresenceTest.php @@ -2,16 +2,15 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Localisations\Presence; -use Rappasoft\LaravelLivewireTables\Tests\Localisations\BaseLocalisationCase; use PHPUnit\Framework\Attributes\DataProvider; +use Rappasoft\LaravelLivewireTables\Tests\Localisations\BaseLocalisationCase; final class CheckKeyPresenceTest extends BaseLocalisationCase { - #[DataProvider('localisationProvider')] public function test_can_get_localised_empty_message(string $locale): void { - $localisedStrings = static::getLocaleStrings($locale); + $localisedStrings = self::getLocaleStrings($locale); $localisedString = $localisedStrings['No items found, try to broaden your search'] ?? $locale; $this->basicTable->changeLocale($locale); @@ -21,14 +20,10 @@ public function test_can_get_localised_empty_message(string $locale): void #[DataProvider('localisationProvider')] public function test_can_check_presence_of_keys(string $locale): void { - $engStrings = static::getEnLocaleStrings(); - $localisedStrings = static::getLocaleStrings($locale); - foreach ($engStrings as $key => $value) - { + $engStrings = self::getEnLocaleStrings(); + $localisedStrings = self::getLocaleStrings($locale); + foreach ($engStrings as $key => $value) { $this->assertNotNull($localisedStrings[$key]); } } - - - } diff --git a/tests/Localisations/Unit/Component/EmptyStringTest.php b/tests/Localisations/Unit/Component/EmptyStringTest.php index ad9244305..bed7acd91 100644 --- a/tests/Localisations/Unit/Component/EmptyStringTest.php +++ b/tests/Localisations/Unit/Component/EmptyStringTest.php @@ -2,12 +2,11 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Localisations\Unit\Component; -use Rappasoft\LaravelLivewireTables\Tests\Localisations\BaseLocalisationCase; use PHPUnit\Framework\Attributes\DataProvider; +use Rappasoft\LaravelLivewireTables\Tests\Localisations\BaseLocalisationCase; final class EmptyStringTest extends BaseLocalisationCase { - #[DataProvider('localisationProvider')] public function test_can_get_localised_empty_message(string $locale): void { @@ -15,5 +14,4 @@ public function test_can_get_localised_empty_message(string $locale): void $this->basicTable->changeLocale($locale); $this->assertEquals($localisedString, $this->basicTable->getEmptyMessage()); } - }