From 156747a37ab5e66fba5d7ce872b0b595f9783b67 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:14:30 +0600 Subject: [PATCH 1/9] LP-102 set rules login_id and password for RegistrationRequest.php --- src/Http/Requests/RegistrationRequest.php | 10 +++++++--- tests/Feature/ExampleTest.php | 5 +++++ tests/Unit/ExampleTest.php | 5 +++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/ExampleTest.php create mode 100644 tests/Unit/ExampleTest.php diff --git a/src/Http/Requests/RegistrationRequest.php b/src/Http/Requests/RegistrationRequest.php index f2f9bc0..95029f6 100644 --- a/src/Http/Requests/RegistrationRequest.php +++ b/src/Http/Requests/RegistrationRequest.php @@ -23,13 +23,11 @@ public function authorize(): bool */ public function rules(): array { - return config('fintech.auth.register_rules', [ + $rules = config('fintech.auth.register_rules', [ //user 'name' => ['required', 'string', 'min:2', 'max:255'], 'mobile' => ['required', 'string', 'min:10'], 'email' => ['required', 'string', 'email:rfc,dns', 'min:2', 'max:255'], - 'login_id' => ['required', 'string', 'min:6', 'max:255'], - 'password' => ['required', 'string', Password::default()], 'pin' => ['required', 'string', 'min:4', 'max:16'], 'parent_id' => ['nullable', 'integer'], 'app_version' => ['nullable', 'string'], @@ -67,5 +65,11 @@ public function rules(): array 'note' => ['string', 'nullable'], 'nationality' => ['string', 'nullable'], ]); + + $rules[config('fintech.auth.auth_field', 'login_id')] = config('fintech.auth.auth_field_rules', ['required', 'string', 'min:6', 'max:255']); + + $rules[config('fintech.auth.password_field', 'password')] = config('fintech.auth.password_field_rules', ['required', 'string', Password::default()]); + + return $rules; } } diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php new file mode 100644 index 0000000..61cd84c --- /dev/null +++ b/tests/Feature/ExampleTest.php @@ -0,0 +1,5 @@ +toBeTrue(); +}); diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php new file mode 100644 index 0000000..61cd84c --- /dev/null +++ b/tests/Unit/ExampleTest.php @@ -0,0 +1,5 @@ +toBeTrue(); +}); From abd919b338c1533e2c41915e15ca022ab5f144da Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:19:30 +0600 Subject: [PATCH 2/9] LP-102 DatabaseMigrations class comment out --- tests/TestCase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 2444eec..b9abf2e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,7 +9,7 @@ class TestCase extends Orchestra { - use DatabaseMigrations; + //use DatabaseMigrations; protected function setUp(): void { @@ -31,8 +31,8 @@ public function getEnvironmentSetUp($app) $migrations = [ -// include __DIR__ . '/../../../database/migrations/2014_10_12_000000_create_users_table.php', -// include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php', + include __DIR__ . '/../../../database/migrations/2014_10_12_000000_create_users_table.php', + include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php', include __DIR__ . '/../database/migrations/2023_09_25_201631_create_user_profiles_table.php', include __DIR__ . '/../database/migrations/2023_09_28_224955_create_permission_tables.php', include __DIR__ . '/../database/migrations/2023_09_28_230630_create_teams_table.php' From 6c8fe9b29b11197f2ce1b7d58f0800d669242596 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:20:17 +0600 Subject: [PATCH 3/9] LP-102 registration create or store test done --- tests/Feature/RegistrationTest.php | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/Feature/RegistrationTest.php diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php new file mode 100644 index 0000000..9080a36 --- /dev/null +++ b/tests/Feature/RegistrationTest.php @@ -0,0 +1,46 @@ + "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "admin@mt-technologies.com", + "login_id" => "01700000001", + "pin" => "123456", + "password" => "12345678", + "app_version" => "0.0.1", + "language" => "bd", + "currency" => "BDT", + "father_name" => "MT", + "mother_name" => "TECHNOLOGIES", + "gender" => "male", + "marital_status" => "unmarried", + "occupation" => "service", + "source_of_income" => "salary", + "id_type" => "passport", + "id_no" => "1234567890", + "id_issue_country" => "BANGLADESH", + "id_expired_at" => "2030-12-31", + "id_issue_at" => "2020-01-01", + "date_of_birth" => "1985-02-19", + "permanent_address" => "DHAKA", + "city_id" => "1", + "state_id" => "1", + "country_id" => "18", + "post_code" => "1100", + "present_address" => "DHAKA", + "present_city_id" => "1", + "present_state_id" => "1", + "present_country_id" => "18", + "present_post_code" => "1100", + "nationality" => "BANGLADESHI" + ])->dd(); + //assertStatus(201); +}); From fbc6282fab0346ba93b57b2c703443a794442ae8 Mon Sep 17 00:00:00 2001 From: mah-shamim Date: Fri, 13 Oct 2023 22:21:27 +0000 Subject: [PATCH 4/9] Fix styling --- tests/Feature/RegistrationTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index 9080a36..d51fea8 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -1,11 +1,7 @@ Date: Sat, 14 Oct 2023 04:25:27 +0600 Subject: [PATCH 5/9] LP-102 TestCase.php rollback --- tests/TestCase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index b9abf2e..2444eec 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,7 +9,7 @@ class TestCase extends Orchestra { - //use DatabaseMigrations; + use DatabaseMigrations; protected function setUp(): void { @@ -31,8 +31,8 @@ public function getEnvironmentSetUp($app) $migrations = [ - include __DIR__ . '/../../../database/migrations/2014_10_12_000000_create_users_table.php', - include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php', +// include __DIR__ . '/../../../database/migrations/2014_10_12_000000_create_users_table.php', +// include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php', include __DIR__ . '/../database/migrations/2023_09_25_201631_create_user_profiles_table.php', include __DIR__ . '/../database/migrations/2023_09_28_224955_create_permission_tables.php', include __DIR__ . '/../database/migrations/2023_09_28_230630_create_teams_table.php' From fe184d69a68b379998bcf83c397b263ca030193e Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:37:24 +0600 Subject: [PATCH 6/9] LP-102 copy form root migration --- .../2014_10_12_000000_create_users_table.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 database/migrations/2014_10_12_000000_create_users_table.php diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php new file mode 100644 index 0000000..444fafb --- /dev/null +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -0,0 +1,32 @@ +id(); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('users'); + } +}; From 62a6b6e90feb00cda4e7f38b9f9cd8a5d0a6b68a Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:37:40 +0600 Subject: [PATCH 7/9] LP-102 remove dd --- tests/Feature/RegistrationTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index d51fea8..b4151be 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -37,6 +37,5 @@ "present_country_id" => "18", "present_post_code" => "1100", "nationality" => "BANGLADESHI" - ])->dd(); - //assertStatus(201); + ])->assertStatus(201); }); From c4f1d7adda320cb92a48fd6513fa5fdc6fd78e3d Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:38:27 +0600 Subject: [PATCH 8/9] LP-102 active user migration --- tests/TestCase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 2444eec..f305e28 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -9,7 +9,7 @@ class TestCase extends Orchestra { - use DatabaseMigrations; + //use DatabaseMigrations; protected function setUp(): void { @@ -31,8 +31,8 @@ public function getEnvironmentSetUp($app) $migrations = [ -// include __DIR__ . '/../../../database/migrations/2014_10_12_000000_create_users_table.php', -// include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php', + include __DIR__ . '/../database/migrations/2014_10_12_000000_create_users_table.php', + include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php', include __DIR__ . '/../database/migrations/2023_09_25_201631_create_user_profiles_table.php', include __DIR__ . '/../database/migrations/2023_09_28_224955_create_permission_tables.php', include __DIR__ . '/../database/migrations/2023_09_28_230630_create_teams_table.php' From 2d3b57cad0bec06697658719e91f7a3366b86c18 Mon Sep 17 00:00:00 2001 From: mah-shamim Date: Fri, 13 Oct 2023 22:40:39 +0000 Subject: [PATCH 9/9] Fix styling --- database/migrations/2014_10_12_000000_create_users_table.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 444fafb..6c2b6d5 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class () extends Migration { /** * Run the migrations. */