From 2c2485fdbf2c8ac98cfbe23b922cdf580bf104d8 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 04:58:48 +0600 Subject: [PATCH 1/8] LP-102 The email field must be a valid email address when registration --- tests/Feature/RegistrationTest.php | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index b4151be..fdb03c4 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -3,6 +3,45 @@ use function Pest\Laravel\postJson; +test('The email field must be a valid email address when registration', function () { + $registration = postJson('/api/auth/register', [ + "name" => "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "admin@mt-technologies", + "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" + ]); + //$this->assertSame('The email field must be a valid email address.', $registration['message']); + expect($registration['message'])->toBe('The email field must be a valid email address.'); + //assertStatus(201); +}); test('registration', function () { postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", From 31b628e3b9a12146296f1014aaff68ab190d4449 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 05:00:14 +0600 Subject: [PATCH 2/8] LP-102 Leave the email field blank when registration --- tests/Feature/RegistrationTest.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index fdb03c4..0a4cd50 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -3,6 +3,46 @@ use function Pest\Laravel\postJson; +test('Leave the email field blank when registration', function () { + $registration = postJson('/api/auth/register', [ + "name" => "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "", + "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($registration['message']); + //$this->assertSame('The email field must be a valid email address.', $registration['message']); + expect($registration['message'])->toBe('The email field is required.'); + //assertStatus(201); +}); test('The email field must be a valid email address when registration', function () { $registration = postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", From 9b02378fa78badc5fb9ec9c41ce701bc5f44718d Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 05:03:07 +0600 Subject: [PATCH 3/8] LP-102 Enter an email address with spaces in the email field when registration --- tests/Feature/RegistrationTest.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index 0a4cd50..e387618 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -3,6 +3,46 @@ use function Pest\Laravel\postJson; +test('Enter an email address with spaces in the email field when registration', function () { + $registration = postJson('/api/auth/register', [ + "name" => "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "ad min@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($registration['message']); + //$this->assertSame('The email field must be a valid email address.', $registration['message']); + expect($registration['message'])->toBe('The email field must be a valid email address.'); + //assertStatus(201); +}); test('Leave the email field blank when registration', function () { $registration = postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", From 60deb9e4068f8dca56955a5527ffd7d6c0468a19 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 05:04:34 +0600 Subject: [PATCH 4/8] LP-102 Enter an email address with special characters in the email field when registration --- tests/Feature/RegistrationTest.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index e387618..2cb13de 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -3,6 +3,46 @@ use function Pest\Laravel\postJson; +test('Enter an email address with special characters in the email field when registration', function () { + $registration = postJson('/api/auth/register', [ + "name" => "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "@dmin@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($registration['message']); + //$this->assertSame('The email field must be a valid email address.', $registration['message']); + expect($registration['message'])->toBe('The email field must be a valid email address.'); + //assertStatus(201); +}); test('Enter an email address with spaces in the email field when registration', function () { $registration = postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", From cb27f0df06d2fb76ddd5ccac3f31fbd2ea8abddb Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sat, 14 Oct 2023 05:10:12 +0600 Subject: [PATCH 5/8] LP-102 Test that the email field is in the correct format when registration --- tests/Feature/RegistrationTest.php | 84 +++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index 2cb13de..84ed64f 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -3,6 +3,86 @@ use function Pest\Laravel\postJson; +/*test('Test that the email field is in the correct format when registration', function () { + $registration = postJson('/api/auth/register', [ + "name" => "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "admin1@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($registration['message']); + //$this->assertSame('The email field must be a valid email address.', $registration['message']); + expect($registration['message'])->toBe('The email field must be a valid email address.'); + //assertStatus(201); +}); +test('Test that the email address is in the correct format when registration', function () { + $registration = postJson('/api/auth/register', [ + "name" => "MT TECHNOLOGIES", + "mobile" => "01700000001", + "email" => "admin1@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($registration['message']); + //$this->assertSame('The email field must be a valid email address.', $registration['message']); + expect($registration['message'])->toBe('The email field must be a valid email address.'); + //assertStatus(201); +});*/ test('Enter an email address with special characters in the email field when registration', function () { $registration = postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", @@ -123,7 +203,7 @@ expect($registration['message'])->toBe('The email field is required.'); //assertStatus(201); }); -test('The email field must be a valid email address when registration', function () { +test('Enter an invalid email address in the email field when registration', function () { $registration = postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", "mobile" => "01700000001", @@ -162,7 +242,7 @@ expect($registration['message'])->toBe('The email field must be a valid email address.'); //assertStatus(201); }); -test('registration', function () { +test('Test that the user can see a confirmation message after a successful registration', function () { postJson('/api/auth/register', [ "name" => "MT TECHNOLOGIES", "mobile" => "01700000001", From c81551251463a3244e6e4a771c38e7ce800099e3 Mon Sep 17 00:00:00 2001 From: mah-shamim Date: Sat, 14 Oct 2023 20:10:48 +0000 Subject: [PATCH 6/8] 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. */ From ba83590f32eae631ab94f29999473abec936c74b Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sun, 15 Oct 2023 02:15:42 +0600 Subject: [PATCH 7/8] LP-102 line#35 remove --- tests/TestCase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index f305e28..3522d63 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -32,7 +32,6 @@ 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/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 25aa70191f112f3c203e8a29cf4d8f083815e9b6 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Sun, 15 Oct 2023 02:26:55 +0600 Subject: [PATCH 8/8] LP-102 project update --- tests/TestCase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index cc6b570..284630f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -32,7 +32,6 @@ 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/2023_09_25_201631_create_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'