Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Oct 13, 2023
2 parents c0fb123 + 83893ff commit deddcc8
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 6 deletions.
31 changes: 31 additions & 0 deletions database/migrations/2014_10_12_000000_create_users_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->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');
}
};
10 changes: 7 additions & 3 deletions src/Http/Requests/RegistrationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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;
}
}
5 changes: 5 additions & 0 deletions tests/Feature/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

test('example', function () {
expect(true)->toBeTrue();
});
41 changes: 41 additions & 0 deletions tests/Feature/RegistrationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php


use function Pest\Laravel\postJson;

test('registration', function () {
postJson('/api/auth/register', [
"name" => "MT TECHNOLOGIES",
"mobile" => "01700000001",
"email" => "[email protected]",
"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"
])->assertStatus(201);
});
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class TestCase extends Orchestra
{
use DatabaseMigrations;
//use DatabaseMigrations;

protected function setUp(): void
{
Expand All @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions tests/Unit/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

test('example', function () {
expect(true)->toBeTrue();
});

0 comments on commit deddcc8

Please sign in to comment.