Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe authored and github-actions[bot] committed Nov 10, 2024
1 parent 19dbaa2 commit 1649677
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
20 changes: 10 additions & 10 deletions tests/Localisations/BaseLocalisationCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@

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;
}

public static function getLocaleStrings($locale): array
{
$baseDir = __DIR__.'/../../resources/lang/';

$items = require($baseDir.$locale."/core.php");
$items = require $baseDir.$locale.'/core.php';

return $items;
}

Expand Down Expand Up @@ -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;
}

}
}
15 changes: 5 additions & 10 deletions tests/Localisations/Presence/CheckKeyPresenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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]);
}
}



}
4 changes: 1 addition & 3 deletions tests/Localisations/Unit/Component/EmptyStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

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
{
$localisedString = $localisationStrings['No items found, try to broaden your search'] ?? $locale;
$this->basicTable->changeLocale($locale);
$this->assertEquals($localisedString, $this->basicTable->getEmptyMessage());
}

}

0 comments on commit 1649677

Please sign in to comment.