- {!! Form::label('email', trans('user.email'), ['class'=>'col-md-4 control-label']) !!}
-
- {!! Form::text('email', null, ['class'=>'form-control','placeholder'=>trans('user.email')]) !!}
-
+ {!! Form::open(['route' => 'app.install', 'class' => '']) !!}
+
Silakan isi formulir di bawah ini untuk membuat akun Administrator dan Agensi.
+
+ {!! FormField::text('agency_name', ['required' => true, 'label' => trans('agency.name')]) !!}
+
+
+ {!! FormField::text('agency_website', ['required' => true, 'label' => trans('agency.website')]) !!}
+
- {!! Form::label('password', trans('auth.password'), ['class'=>'col-md-4 control-label']) !!}
+
- {!! Form::password('password', ['class'=>'form-control','placeholder'=>trans('auth.password')]) !!}
+ {!! FormField::text('name', ['required' => true, 'label' => trans('user.name')]) !!}
+
+
+ {!! FormField::email('email', ['required' => true, 'label' => trans('auth.email')]) !!}
-
diff --git a/routes/web/account.php b/routes/web/account.php
index 4a754f1..edea9c5 100644
--- a/routes/web/account.php
+++ b/routes/web/account.php
@@ -1,10 +1,10 @@
'web', 'as' => 'auth.'], function () {
- Route::get('register', ['as' => 'register', 'uses' => 'AuthController@getRegister']);
- Route::post('register', ['as' => 'register', 'uses' => 'AuthController@postRegister']);
+Route::group(['middleware' => 'web'], function () {
+ Route::get('app-install', ['as' => 'app.install', 'uses' => 'InstallationController@getRegister']);
+ Route::post('app-install', ['as' => 'app.install', 'uses' => 'InstallationController@postRegister']);
});
// Authentication Routes...
diff --git a/tests/Feature/Auth/InstallationTest.php b/tests/Feature/Auth/InstallationTest.php
new file mode 100644
index 0000000..d3f4a3c
--- /dev/null
+++ b/tests/Feature/Auth/InstallationTest.php
@@ -0,0 +1,74 @@
+
+ */
+class InstallationTest extends TestCase
+{
+ /** @test */
+ public function user_cannot_visit_register_page_if_user_already_exists_in_database()
+ {
+ factory(User::class)->create(['email' => 'member@app.dev']);
+ $this->visit(route('app.install'));
+ $this->seePageIs(route('auth.login'));
+ }
+
+ /** @test */
+ public function registration_validation()
+ {
+ $this->visit(route('app.install'));
+
+ $this->seePageIs(route('app.install'));
+
+ $this->submitForm(trans('auth.register'), [
+ 'name' => 'Nama Member',
+ 'email' => 'email',
+ 'password' => 'password',
+ 'password_confirmation' => 'password..',
+ ]);
+
+ $this->seePageIs(route('app.install'));
+ }
+
+ /** @test */
+ public function member_register_successfully()
+ {
+ $this->visit(route('app.install'));
+ $this->seePageIs(route('app.install'));
+
+ $this->submitForm(trans('auth.register'), [
+ 'agency_name' => 'Nama Agensi',
+ 'agency_website' => 'https://example.com',
+ 'name' => 'Nama Admin',
+ 'email' => 'email@mail.com',
+ 'password' => 'password.111',
+ 'password_confirmation' => 'password.111',
+ ]);
+
+ $this->seePageIs(route('home'));
+
+ $this->see(trans('auth.welcome', ['name' => 'Nama Admin']));
+
+ $this->seeInDatabase('users', [
+ 'name' => 'Nama Admin',
+ 'email' => 'email@mail.com',
+ ]);
+
+ $this->seeInDatabase('site_options', [
+ 'key' => 'agency_name',
+ 'value' => 'Nama Agensi',
+ ]);
+
+ $this->seeInDatabase('site_options', [
+ 'key' => 'agency_website',
+ 'value' => 'https://example.com',
+ ]);
+ }
+}
diff --git a/tests/Feature/Auth/LoginTest.php b/tests/Feature/Auth/LoginTest.php
index 3ff5b6c..5180b9f 100644
--- a/tests/Feature/Auth/LoginTest.php
+++ b/tests/Feature/Auth/LoginTest.php
@@ -19,8 +19,9 @@ class LoginTest extends TestCase
'password' => 'member',
]);
- $this->seePageIs(route('home'));
$this->see(trans('auth.welcome', ['name' => $user->name]));
+ $this->seePageIs(route('home'));
+ $this->seeIsAuthenticated();
$this->click(trans('auth.logout'));
@@ -32,10 +33,13 @@ class LoginTest extends TestCase
public function member_invalid_login()
{
$this->visit(route('auth.login'));
- $this->type('email@mail.com', 'email');
- $this->type('password.112', 'password');
- $this->press(trans('auth.login'));
+
+ $this->submitForm(trans('auth.login'), [
+ 'email' => 'email@mail.com',
+ 'password' => 'member',
+ ]);
+
$this->seePageIs(route('auth.login'));
- $this->see(trans('auth.failed'));
+ $this->dontSeeIsAuthenticated();
}
}
diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php
deleted file mode 100644
index 2a015ad..0000000
--- a/tests/Feature/Auth/RegistrationTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-create(['email' => 'member@app.dev']);
-
- $this->visit(route('auth.register'));
-
- $this->submitForm(trans('auth.register'), [
- 'name' => '',
- 'email' => 'member@app.dev',
- 'password' => '',
- 'password_confirmation' => '',
- ]);
-
- $this->seePageIs(route('auth.register'));
- $this->see('Nama harus diisi.');
- $this->see('Email ini sudah terdaftar.');
- $this->see('Password harus diisi.');
- $this->see('Konfirmasi password harus diisi.');
-
- $this->submitForm(trans('auth.register'), [
- 'name' => 'Nama Member',
- 'email' => 'email',
- 'password' => 'password',
- 'password_confirmation' => 'password..',
- ]);
-
- $this->seePageIs(route('auth.register'));
- $this->see('Email tidak valid.');
- $this->see('Konfirmasi password tidak sesuai.');
- }
-
- /** @test */
- public function member_register_successfully()
- {
- $this->visit(route('auth.register'));
- $this->submitForm(trans('auth.register'), [
- 'name' => 'Nama Member',
- 'email' => 'email@mail.com',
- 'password' => 'password.111',
- 'password_confirmation' => 'password.111',
- ]);
-
- $this->seePageIs(route('home'));
-
- $this->see(trans('auth.welcome', ['name' => 'Nama Member']));
-
- $this->seeInDatabase('users', [
- 'name' => 'Nama Member',
- 'email' => 'email@mail.com',
- ]);
- }
-}