Browse Source

Set default lang to id and fixed some feature test to pass al test suites

pull/3/head
Nafies Luthfi 8 years ago
parent
commit
0cff906c79
  1. 2
      app/Http/Middleware/Lang.php
  2. 1
      resources/lang/en/app.php
  3. 1
      resources/lang/id/app.php
  4. 24
      tests/Feature/ManageUserFamiliesTest.php
  5. 2
      tests/Feature/UsersProfileTest.php

2
app/Http/Middleware/Lang.php

@ -15,7 +15,7 @@ class Lang
*/
public function handle($request, Closure $next)
{
app()->setLocale(request('lang', session('lang')));
app()->setLocale(request('lang', session('lang', 'id')));
if (request('lang')) {
session(['lang' => request('lang')]);
}

1
resources/lang/en/app.php

@ -19,6 +19,7 @@ return [
// Actions
'edit' => 'Edit',
'update' => 'Update',
'show_profile' => 'Show Profile',
'show_family_chart' => 'Show Family Chart',
'show_family_tree' => 'Show Family Tree',

1
resources/lang/id/app.php

@ -19,6 +19,7 @@ return [
// Actions
'edit' => 'Edit',
'update' => 'Update',
'show_profile' => 'Lihat Profil',
'show_family_chart' => 'Lihat Bagan Keluarga',
'show_family_tree' => 'Lihat Pohon Keluarga',

24
tests/Feature/ManageUserFamiliesTest.php

@ -17,7 +17,7 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->dontSeeElement('input', ['name' => 'set_father']);
$this->click('Set Ayah');
$this->click(trans('user.set_father'));
$this->seePageIs(route('users.show', [$user->id, 'action' => 'set_father']));
$this->seeElement('input', ['name' => 'set_father']);
@ -39,7 +39,7 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->dontSeeElement('input', ['name' => 'set_mother']);
$this->click('Set Ibu');
$this->click(trans('user.set_mother'));
$this->seePageIs(route('users.show', [$user->id, 'action' => 'set_mother']));
$this->seeElement('input', ['name' => 'set_mother']);
@ -61,12 +61,12 @@ class ManageUserFamiliesTest extends TestCase
$user = $this->loginAsUser(['gender_id' => 1]);
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->click('Tambah Anak');
$this->click(trans('user.add_child'));
$this->seeElement('input', ['name' => 'add_child_name']);
$this->seeElement('input', ['name' => 'add_child_gender_id']);
$this->seeElement('select', ['name' => 'add_child_parent_id']);
$this->submitForm('Tambah Anak', [
$this->submitForm(trans('user.add_child'), [
'add_child_name' => 'Nama Anak 1',
'add_child_gender_id' => 1,
'add_child_parent_id' => '',
@ -94,12 +94,12 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->click('Tambah Anak');
$this->click(trans('user.add_child'));
$this->seeElement('input', ['name' => 'add_child_name']);
$this->seeElement('input', ['name' => 'add_child_gender_id']);
$this->seeElement('select', ['name' => 'add_child_parent_id']);
$this->submitForm('Tambah Anak', [
$this->submitForm(trans('user.add_child'), [
'add_child_name' => 'Nama Anak 1',
'add_child_gender_id' => 1,
'add_child_parent_id' => $marriageId,
@ -120,7 +120,7 @@ class ManageUserFamiliesTest extends TestCase
$user = $this->loginAsUser(['gender_id' => 1]);
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->click('Tambah Isteri');
$this->click(trans('user.add_wife'));
$this->seeElement('input', ['name' => 'set_wife']);
$this->submitForm('set_wife_button', [
@ -146,7 +146,7 @@ class ManageUserFamiliesTest extends TestCase
$user = $this->loginAsUser(['gender_id' => 2]);
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->click('Tambah Suami');
$this->click(trans('user.add_husband'));
$this->seeElement('input', ['name' => 'set_husband']);
$this->submitForm('set_husband_button', [
@ -176,7 +176,7 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->dontSeeElement('input', ['name' => 'set_father']);
$this->click('Set Ayah');
$this->click(trans('user.set_father'));
$this->seePageIs(route('users.show', [$user->id, 'action' => 'set_father']));
$this->seeElement('input', ['name' => 'set_father']);
$this->seeElement('select', ['name' => 'set_father_id']);
@ -198,7 +198,7 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->dontSeeElement('input', ['name' => 'set_mother']);
$this->click('Set Ibu');
$this->click(trans('user.set_mother'));
$this->seePageIs(route('users.show', [$user->id, 'action' => 'set_mother']));
$this->seeElement('input', ['name' => 'set_mother']);
$this->seeElement('select', ['name' => 'set_mother_id']);
@ -219,7 +219,7 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->click('Tambah Isteri');
$this->click(trans('user.add_wife'));
$this->seeElement('input', ['name' => 'set_wife']);
$this->seeElement('select', ['name' => 'set_wife_id']);
@ -242,7 +242,7 @@ class ManageUserFamiliesTest extends TestCase
$this->visit(route('profile'));
$this->seePageIs(route('profile'));
$this->click('Tambah Suami');
$this->click(trans('user.add_husband'));
$this->seeElement('input', ['name' => 'set_husband']);
$this->seeElement('select', ['name' => 'set_husband_id']);

2
tests/Feature/UsersProfileTest.php

@ -25,7 +25,7 @@ class UsersProfileTest extends TestCase
$this->visit(route('users.edit', $user->id));
$this->seePageIs(route('users.edit', $user->id));
$this->submitForm('Update', [
$this->submitForm(trans('app.update'), [
'nickname' => 'Nama Panggilan',
'name' => 'Nama User',
'gender_id' => 1,

Loading…
Cancel
Save