Browse Source

Restructure login and register test and Fixed project index view

pull/1/head
Nafies Luthfi 9 years ago
parent
commit
31eb927e31
  1. 6
      resources/views/projects/index.blade.php
  2. 37
      tests/Feature/Auth/MemberLoginTest.php
  3. 41
      tests/Feature/Auth/MemberRegistrationTest.php
  4. 2
      tests/Feature/ManageUsersTest.php

6
resources/views/projects/index.blade.php

@ -10,12 +10,13 @@
<div class="well well-sm text-right">
<div class="pull-left hidden-xs">{!! str_replace('/?', '?', $projects->appends(Request::except('page'))->render()) !!}</div>
{!! 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() !!}
</div>
<div class="table-responsive">
<table class="table table-condensed table-hover">
<thead>
<th>{{ trans('app.table_no') }}</th>
@ -51,5 +52,6 @@
@endforelse
</tbody>
</table>
{!! str_replace('/?', '?', $projects->appends(Request::except('page'))->render()) !!}
</div>
{!! str_replace('/?', '?', $projects->appends(Request::except('page'))->render()) !!}
@endsection

37
tests/Feature/Auth/MemberLoginTest.php

@ -0,0 +1,37 @@
<?php
namespace Tests\Feature\Auth;
use App\Entities\Users\User;
use Tests\TestCase;
class MemberLoginTest extends TestCase
{
/** @test */
public function member_register_and_login_successfully()
{
$user = factory(User::class)->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');
}
}

41
tests/Feature/Auth/MemberRegistrationAndLoginTest.php → 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');
}
}

2
tests/Feature/Auth/ManageUsersTest.php → tests/Feature/ManageUsersTest.php

@ -1,6 +1,6 @@
<?php
namespace Tests\Feature\Auth;
namespace Tests\Feature;
use App\Entities\Users\User;
use Tests\TestCase;
Loading…
Cancel
Save