Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@
"license": "MIT",
"require": {
"php": "^8.2",
"codedor/filament-translatable-tabs": "dev-feature/filament-v4",
"codedor/filament-translatable-tabs": "dev-feature/filament-v5",
"codedor/laravel-locale-collection": "^1.2.1",
"filament/filament": "^4.0",
"filament/filament": "^4.0|^5.0",
"illuminate/contracts": "^10.0|^11.0|^12.0",
"maatwebsite/excel": "^3.1",
"spatie/laravel-package-tools": "^1.12",
"spatie/laravel-translatable": "^6.4"
},
"require-dev": {
"filament/upgrade": "^4.0",
"larastan/larastan": "^2.4|^3.0",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.0|^8.0",
"orchestra/testbench": "^8.0|^9.0|^10.0",
"pestphp/pest": "^2.0|^3.0",
"pestphp/pest-plugin-laravel": "^2.0|^3.0",
"pestphp/pest-plugin-livewire": "^2.0|^3.0",
"phpstan/extension-installer": "^1.1|^2.0",
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
"phpstan/phpstan-phpunit": "^1.0|^2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Codedor\LocaleCollection\Locale;
use Codedor\TranslatableStrings\Filament\Resources\TranslatableStringResource\Pages\EditTranslatableString;
use Codedor\TranslatableStrings\Tests\Fixtures\Models\User;

use function Pest\Livewire\livewire;
use Livewire\Livewire;

beforeEach(function () {
LocaleCollection::push(new Locale('en'))
Expand All @@ -17,7 +16,7 @@
});

it('can edit a translatable string', function () {
livewire(EditTranslatableString::class, [
Livewire::test(EditTranslatableString::class, [
'record' => $this->string->getRouteKey(),
])
->assertSuccessful()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Livewire\Livewire;
use Mockery\MockInterface;

use function Pest\Livewire\livewire;

beforeEach(function () {
LocaleCollection::push(new Locale('en'))
->push(new Locale('nl'));
Expand All @@ -28,28 +27,28 @@
});

it('can list translatable strings', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertOk()
->assertCanSeeTableRecords($this->strings);
});

it('can sort table', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->sortTable('scope')
->assertCanSeeTableRecords($this->strings->sortBy('scope'), inOrder: true)
->sortTable('name', 'desc')
->assertCanSeeTableRecords($this->strings->sortByDesc('name'), inOrder: true)
->sortTable('created_at', 'desc')
->assertCanSeeTableRecords($this->strings->sortByDesc('created_at'), inOrder: true)
->sortTable()
->assertCanSeeTableRecords($this->strings->sortByDesc('created_at'), inOrder: true);
->assertCanSeeTableRecords($this->strings->sortBy('created_at'), inOrder: true);
});

it('can filter on filled in value', function () {
$emptyStrings = $this->strings->filter(fn ($string) => blank($string->value));
$notEmptyStrings = $this->strings->filter(fn ($string) => ! blank($string->value));

livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->filterTable('filled_in', '')
->assertCanSeeTableRecords($this->strings)
->filterTable('filled_in', true)
Expand All @@ -61,30 +60,30 @@
});

it('can filter on scope', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->filterTable('scope', 'd scope')
->assertCanSeeTableRecords($this->strings->filter(fn ($string) => $string->scope === 'd scope'))
->assertCanNotSeeTableRecords($this->strings->filter(fn ($string) => $string->scope !== 'd scope'));
});

it('has an edit action', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertTableActionExists('edit');
});

it('has no delete action', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertTableActionDoesNotExist('delete')
->assertTableBulkActionDoesNotExist('delete');
});

it('has no create action', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertTableActionDoesNotExist('create');
});

it('has an import action that can throw an error', function () {
livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertActionExists('import')
->callAction('import');

Expand All @@ -97,7 +96,7 @@
file_get_contents(__DIR__ . '/../../../../Fixtures/import_truncate.xlsx', 'import_truncate.xlsx')
);

livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertActionExists('import')
->callAction('import', [
'overwrite' => true,
Expand Down Expand Up @@ -137,15 +136,15 @@
})
);

livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertActionExists('export')
->callAction('export');
});

it('has an extract and parse action', function () {
Queue::fake();

livewire(ListTranslatableStrings::class)
Livewire::test(ListTranslatableStrings::class)
->assertActionExists('extract_parse')
->callAction('extract_parse');

Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Codedor\TranslatableTabs\Providers\TranslatableTabsServiceProvider;
use Filament\Actions\ActionsServiceProvider;
use Filament\FilamentServiceProvider;
use Filament\FilamentServiceProvider as BaseFilamentServiceProvider;
use Filament\Forms\FormsServiceProvider;
use Filament\Infolists\InfolistsServiceProvider;
use Filament\Notifications\NotificationsServiceProvider;
Expand Down