Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/Database/Factories/TranslationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace JoeDixon\Translation\Database\Factories;

use JoeDixon\Translation\Language;
use Illuminate\Database\Eloquent\Factories\Factory;
use JoeDixon\Translation\Language;
use JoeDixon\Translation\Translation;

class TranslationFactory extends Factory
Expand Down
14 changes: 7 additions & 7 deletions tests/DatabaseDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public function a_list_of_languages_can_be_viewed()
public function the_language_creation_page_can_be_viewed()
{
$this->translation->addGroupTranslation(config('app.locale'), 'translation::translation', 'add_language', 'Add a new language');
$this->get(config('translation.ui_url') . '/create')
$this->get(config('translation.ui_url').'/create')
->assertSee('Add a new language');
}

Expand All @@ -304,7 +304,7 @@ public function a_list_of_translations_can_be_viewed()
TranslationModel::factory()->single()->create(['language_id' => $default->id, 'key' => 'Hello', 'value' => 'Hello!']);
TranslationModel::factory()->single()->create(['language_id' => $default->id, 'key' => "What's up", 'value' => 'Sup!']);

$this->get(config('translation.ui_url') . '/en/translations')
$this->get(config('translation.ui_url').'/en/translations')
->assertSee('hello')
->assertSee('whats_up')
->assertSee('Hello')
Expand All @@ -315,14 +315,14 @@ public function a_list_of_translations_can_be_viewed()
public function the_translation_creation_page_can_be_viewed()
{
$this->translation->addGroupTranslation('en', 'translation::translation', 'add_translation', 'Add a translation');
$this->get(config('translation.ui_url') . '/' . config('app.locale') . '/translations/create')
$this->get(config('translation.ui_url').'/'.config('app.locale').'/translations/create')
->assertSee('Add a translation');
}

/** @test */
public function a_new_translation_can_be_added()
{
$this->post(config('translation.ui_url') . '/' . config('app.locale') . '/translations', ['group' => 'single', 'key' => 'joe', 'value' => 'is cool'])
$this->post(config('translation.ui_url').'/'.config('app.locale').'/translations', ['group' => 'single', 'key' => 'joe', 'value' => 'is cool'])
->assertRedirect();

$this->assertDatabaseHas('translations', ['language_id' => 1, 'key' => 'joe', 'value' => 'is cool']);
Expand All @@ -335,7 +335,7 @@ public function a_translation_can_be_updated()
TranslationModel::factory()->group()->create(['language_id' => $default->id, 'group' => 'test', 'key' => 'hello', 'value' => 'Hello']);
$this->assertDatabaseHas('translations', ['language_id' => 1, 'group' => 'test', 'key' => 'hello', 'value' => 'Hello']);

$this->post(config('translation.ui_url') . '/en', ['group' => 'test', 'key' => 'hello', 'value' => 'Hello there!'])
$this->post(config('translation.ui_url').'/en', ['group' => 'test', 'key' => 'hello', 'value' => 'Hello there!'])
->assertStatus(200);

$this->assertDatabaseHas('translations', ['language_id' => 1, 'group' => 'test', 'key' => 'hello', 'value' => 'Hello there!']);
Expand All @@ -347,7 +347,7 @@ public function adding_a_translation_fires_an_event_with_the_expected_data()
Event::fake();

$data = ['key' => 'joe', 'value' => 'is cool'];
$this->post(config('translation.ui_url') . '/en/translations', $data);
$this->post(config('translation.ui_url').'/en/translations', $data);

Event::assertDispatched(TranslationAdded::class, function ($event) use ($data) {
return $event->language === 'en' &&
Expand All @@ -363,7 +363,7 @@ public function updating_a_translation_fires_an_event_with_the_expected_data()
Event::fake();

$data = ['group' => 'test', 'key' => 'hello', 'value' => 'Hello there!'];
$this->post(config('translation.ui_url') . '/en/translations', $data);
$this->post(config('translation.ui_url').'/en/translations', $data);

Event::assertDispatched(TranslationAdded::class, function ($event) use ($data) {
return $event->language === 'en' &&
Expand Down