Skip to content

Commit 202e8a2

Browse files
committed
Update tests and add language files for commands
Added new language files for authors and books in English, and an unrelated file in Dutch for command tests. Updated PhraseControllerTest to use PUT for phrase updates. Modified TranslationControllerTest to use 'language_ids' instead of 'languages', and changed deletion assertions to check for status 200 instead of redirects. Set a fixed app key in TestCase environment setup for consistent test configuration.
1 parent 28ccbbe commit 202e8a2

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'title' => 'Authors',
5+
];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'title' => 'Books',
5+
];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
return [];

tests/Http/Controllers/PhraseControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
it('can update phrase', function () {
3636
$this->actingAs($this->owner, 'translations')
37-
->post(route('ltu.phrases.update', [
37+
->put(route('ltu.phrases.update', [
3838
'phrase' => $this->phrase->uuid,
3939
'translation' => $this->translation->id,
4040
]), [

tests/Http/Controllers/TranslationControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
it('can store new translation', function () {
2626
$this->actingAs($this->owner, 'translations')
2727
->post(route('ltu.translation.store'), [
28-
'languages' => [Language::inRandomOrder()->first()->id],
28+
'language_ids' => [Language::inRandomOrder()->first()->id],
2929
])
3030
->assertRedirect(route('ltu.translation.index'));
3131

@@ -35,7 +35,7 @@
3535
it('translation can be deleted', function () {
3636
$this->actingAs($this->owner, 'translations')
3737
->delete(route('ltu.translation.delete', $this->translation->id))
38-
->assertRedirect(route('ltu.translation.index'));
38+
->assertStatus(200);
3939

4040
$this->assertCount(1, Translation::all());
4141
});
@@ -45,7 +45,7 @@
4545
->post(route('ltu.translation.delete_multiple', [
4646
'selected_ids' => [$this->translation->id],
4747
]))
48-
->assertRedirect(route('ltu.translation.index'));
48+
->assertStatus(200);
4949

5050
$this->assertCount(1, Translation::all());
5151
});

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ protected function refreshTestDatabase(): void
5959

6060
public function getEnvironmentSetUp($app): void
6161
{
62+
config()->set('app.key', 'base64:'.base64_encode('Dred1234567890123456789012345678'));
6263
config()->set('cache.default', 'array');
6364
config()->set('inertia.testing.ensure_pages_exist', false);
6465

0 commit comments

Comments
 (0)