Skip to content

Commit

Permalink
Merge pull request #423 from rbngzlv/add-test-pr-418
Browse files Browse the repository at this point in the history
Add missing test for saving translations standalone
  • Loading branch information
Gummibeer authored Aug 26, 2024
2 parents 8df4b84 + 19f0792 commit 3147f70
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/TranslatableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,21 @@ public function it_creates_a_new_translation(): void
self::assertEquals('Peas', $vegetable->translate('en')->name);
}

#[Test]
public function new_translation_can_be_saved_directly(): void
{
$vegetable = factory(Vegetable::class)->create();

$translation = $vegetable->getNewTranslation('en');
$translation->name = 'Peas';
$translation->save();

self::assertDatabaseHas('vegetable_translations', [
'locale' => 'en',
'name' => 'Peas',
]);
}

#[Test]
public function the_locale_key_is_locale_by_default(): void
{
Expand Down

0 comments on commit 3147f70

Please sign in to comment.