From 31eb927e3139f1bc30a7b52b4f411d951a2cb340 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Fri, 28 Jul 2017 07:48:17 +0800 Subject: [PATCH] Restructure login and register test and Fixed project index view --- resources/views/projects/index.blade.php | 6 ++-- tests/Feature/Auth/MemberLoginTest.php | 37 +++++++++++++++++++ ...AndLoginTest.php => MemberRegistrationTest.php} | 41 +--------------------- tests/Feature/{Auth => }/ManageUsersTest.php | 2 +- 4 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 tests/Feature/Auth/MemberLoginTest.php rename tests/Feature/Auth/{MemberRegistrationAndLoginTest.php => MemberRegistrationTest.php} (53%) rename tests/Feature/{Auth => }/ManageUsersTest.php (98%) diff --git a/resources/views/projects/index.blade.php b/resources/views/projects/index.blade.php index 5fa8ceb..7e75d88 100755 --- a/resources/views/projects/index.blade.php +++ b/resources/views/projects/index.blade.php @@ -10,12 +10,13 @@
{!! Form::open(['method'=>'get','class'=>'form-inline']) !!} - {!! Form::select('status', getProjectStatusesList(), Request::get('status'), ['class'=>'form-control','placeholder'=> '- Semua Project -']) !!} + {!! FormField::select('status', getProjectStatusesList(), ['value' => Request::get('status'), 'placeholder'=> 'Semua Project']) !!} {!! Form::text('q', Request::get('q'), ['class'=>'form-control index-search-field','placeholder'=>trans('project.search'),'style' => 'width:350px']) !!} {!! Form::submit(trans('project.search'), ['class' => 'btn btn-info btn-sm']) !!} {!! link_to_route('projects.index','Reset',[],['class' => 'btn btn-default btn-sm']) !!} {!! Form::close() !!}
+
@@ -51,5 +52,6 @@ @endforelse
{{ trans('app.table_no') }}
- {!! str_replace('/?', '?', $projects->appends(Request::except('page'))->render()) !!} +
+{!! str_replace('/?', '?', $projects->appends(Request::except('page'))->render()) !!} @endsection diff --git a/tests/Feature/Auth/MemberLoginTest.php b/tests/Feature/Auth/MemberLoginTest.php new file mode 100644 index 0000000..705a6a0 --- /dev/null +++ b/tests/Feature/Auth/MemberLoginTest.php @@ -0,0 +1,37 @@ +create(['name' => 'Nama Member', 'username' => 'namamember', 'email' => 'email@mail.com']); + $user->assignRole('customer'); + + $this->visit(route('auth.login')); + $this->type('namamember','username'); + $this->type('member','password'); + $this->press(trans('auth.login')); + $this->seePageIs(route('home')); + $this->see('Selamat datang kembali Nama Member.'); + $this->click('Keluar'); + $this->seePageIs(route('auth.login')); + $this->see('Anda telah logout.'); + } + + /** @test */ + public function member_invalid_login() + { + $this->visit(route('auth.login')); + $this->type('namamember','username'); + $this->type('password.112','password'); + $this->press(trans('auth.login')); + $this->seePageIs(route('auth.login')); + $this->see('Mohon maaf, anda tidak dapat login'); + } +} diff --git a/tests/Feature/Auth/MemberRegistrationAndLoginTest.php b/tests/Feature/Auth/MemberRegistrationTest.php similarity index 53% rename from tests/Feature/Auth/MemberRegistrationAndLoginTest.php rename to tests/Feature/Auth/MemberRegistrationTest.php index 8ea68ba..4eff33d 100644 --- a/tests/Feature/Auth/MemberRegistrationAndLoginTest.php +++ b/tests/Feature/Auth/MemberRegistrationTest.php @@ -5,14 +5,11 @@ namespace Tests\Feature\Auth; use App\Entities\Users\User; use Tests\TestCase; -class MemberRegistrationAndLoginTest extends TestCase +class MemberRegistrationTest extends TestCase { /** @test */ public function registration_validation() { - // $user = factory(User::class)->create(['email' => 'member@app.dev']); - // $user->assignRole('customer'); - $this->visit(route('auth.register')); $this->type('', 'name'); $this->type('', 'username'); @@ -51,40 +48,4 @@ class MemberRegistrationAndLoginTest extends TestCase $this->seePageIs(route('home')); $this->see('Selamat datang Nama Member.'); } - - /** @test */ - public function member_register_and_login_successfully() - { - $this->visit(route('auth.register')); - $this->type('Nama Member', 'name'); - $this->type('namamember', 'username'); - $this->type('email@mail.com', 'email'); - $this->type('password.111', 'password'); - $this->type('password.111', 'password_confirmation'); - $this->press('Buat Akun Baru'); - $this->seePageIs(route('home')); - $this->see('Selamat datang Nama Member.'); - $this->click('Keluar'); - - $this->visit(route('auth.login')); - $this->type('namamember','username'); - $this->type('password.111','password'); - $this->press('Login'); - $this->seePageIs(route('home')); - $this->see('Selamat datang kembali Nama Member.'); - $this->click('Keluar'); - $this->seePageIs(route('auth.login')); - $this->see('Anda telah logout.'); - } - - /** @test */ - public function member_invalid_login() - { - $this->visit(route('auth.login')); - $this->type('namamember','username'); - $this->type('password.112','password'); - $this->press('Login'); - $this->seePageIs(route('auth.login')); - $this->see('Mohon maaf, anda tidak dapat login'); - } } diff --git a/tests/Feature/Auth/ManageUsersTest.php b/tests/Feature/ManageUsersTest.php similarity index 98% rename from tests/Feature/Auth/ManageUsersTest.php rename to tests/Feature/ManageUsersTest.php index 80fde6e..2aaed12 100644 --- a/tests/Feature/Auth/ManageUsersTest.php +++ b/tests/Feature/ManageUsersTest.php @@ -1,6 +1,6 @@