write test for another items and change some part of the code

This commit is contained in:
2025-05-14 15:38:33 +03:30
parent db8cda55df
commit 16fe0be555
20 changed files with 1258 additions and 45 deletions

View File

@@ -16,7 +16,7 @@ class UpdateTest extends TestCase
{
$permission = Permission::factory()->create();
$response = $this->postJson(route('permissions.update', $permission));
$response = $this->postJson(route('permissions.update', [$permission->id]));
$response->assertUnauthorized();
}
@@ -28,7 +28,7 @@ class UpdateTest extends TestCase
$user = User::factory()->create();
$permission = Permission::factory()->create();
$response = $this->actingAs($user)->postJson(route('permissions.update', $permission));
$response = $this->actingAs($user)->postJson(route('permissions.update', [$permission->id]));
$response->assertUnprocessable()
->assertInvalid([
@@ -42,7 +42,7 @@ class UpdateTest extends TestCase
$user = User::factory()->create();
$permission = Permission::factory()->create();
$response = $this->actingAs($user)->postJson(route('permissions.update', $permission), [
$response = $this->actingAs($user)->postJson(route('permissions.update', [$permission->id]), [
'name' =>$this->faker->randomDigit(),
'name_fa' => $this->faker->randomDigit(),
]);
@@ -61,7 +61,7 @@ class UpdateTest extends TestCase
$permission1 = Permission::factory()->create();
$permission2 = Permission::factory()->create();
$response = $this->actingAs($user)->postJson(route('permissions.update', $permission1), [
$response = $this->actingAs($user)->postJson(route('permissions.update', [$permission1->id]), [
'name' => $permission2->name,
'name_fa' => $permission2->name_fa,
]);
@@ -80,7 +80,7 @@ class UpdateTest extends TestCase
$longString = $this->faker->regexify('[a-zA-Z0-9]{256}');
$response = $this->actingAs($user)->postJson(route('permissions.update', $permission), [
$response = $this->actingAs($user)->postJson(route('permissions.update', [$permission->id]), [
'name' => $longString,
'name_fa' => $longString,
]);
@@ -102,7 +102,7 @@ class UpdateTest extends TestCase
'name_fa' => $this->faker->unique()->words(2, true),
];
$response = $this->actingAs($user)->postJson(route('permissions.update', $permission), $payload);
$response = $this->actingAs($user)->postJson(route('permissions.update', [$permission->id]), $payload);
$response->assertOk()
->assertJson([