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 14, 2023
2 parents 9aae9d3 + f0c2e65 commit 798a255
Show file tree
Hide file tree
Showing 2 changed files with 240 additions and 2 deletions.
241 changes: 240 additions & 1 deletion tests/Feature/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,246 @@

use function Pest\Laravel\postJson;

test('registration', function () {
/*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" => "[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"
]);
//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" => "[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"
]);
//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",
"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"
]);
//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",
"mobile" => "01700000001",
"email" => "ad [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"
]);
//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",
"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('Enter an invalid email address in the email field 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('Test that the user can see a confirmation message after a successful registration', function () {
postJson('/api/auth/register', [
"name" => "MT TECHNOLOGIES",
"mobile" => "01700000001",
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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'
Expand Down

0 comments on commit 798a255

Please sign in to comment.