Skip to content

Commit

Permalink
add missing test for saving translations standalone
Browse files Browse the repository at this point in the history
add test for changes introduced in PR #418
  • Loading branch information
rbngzlv committed Aug 12, 2024
1 parent 695792b commit 19f0792
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 19f0792

Please sign in to comment.