getJson(route('calls.list')); // $response->assertStatus(401); // } // // public function test_user_without_permission_cannot_access(): void // { // $user = User::factory()->create(); // $this->actingAs($user); // // $response = $this->getJson(route('calls.list')); // $response->assertForbidden(); // } // // public function test_phone_number_must_be_string(): void // { // $user = User::factory() // ->has(Permission::factory([ // 'name' => 'manage_calls', // 'name_fa' => 'مدیریت تماس‌ها', // ])) // ->create(); // // // 🟢 احراز هویت کاربر قبل از ارسال درخواست // $this->actingAs($user); // // $response = $this->getJson(route('calls.list', [ // 'phone_number' => $this->faker->in, // ])); // // $response->assertUnprocessable() // ->assertInvalid([ // 'phone_number' => __('validation.string', ['attribute' => 'شماره تلفن']), // ]); // } // // // public function test_size_must_be_integer(): void // { // $user = $this->createUserWithPermission(); // $this->actingAs($user); // // $response = $this->getJson(route('calls.list', [ // 'size' => 'not-an-integer', // ])); // // $response->assertUnprocessable() // ->assertInvalid([ // 'size' => __('validation.integer', ['attribute' => 'حداکثر تعداد']), // ]); // } // // public function test_calls_are_returned_with_limit(): void // { // $user = $this->createUserWithPermission(); // $this->actingAs($user); // // Call::factory()->count(8)->create(); // // $response = $this->getJson(route('calls.list', ['size' => 5])); // // $response->assertOk() // ->assertJsonCount(5, 'data') // ->assertJson(fn (AssertableJson $json) => // $json->has('message') // ->has('data') // ->has('data.0', fn (AssertableJson $json) => // $json->hasAll([ // 'id', // 'operator_id', // 'operator_full_name', // 'operator_username', // 'telephone_id', // 'caller_phone_number', // 'description', // 'category_id', // 'category_name', // 'subcategory_id', // 'subcategory_name', // 'created_at', // ]) // ) // ); // } // // public function test_calls_are_filtered_by_phone_number(): void // { // $user = $this->createUserWithPermission(); // $this->actingAs($user); // // $targetPhone = '09' . $this->faker->numberBetween(100000000, 999999999); // Call::factory()->count(4)->create(['caller_phone_number' => $targetPhone]); // Call::factory()->count(2)->create(); // other numbers // // $response = $this->getJson(route('calls.list', ['phone_number' => $targetPhone])); // // $response->assertOk() // ->assertJsonCount(4, 'data') // ->assertJsonFragment(['caller_phone_number' => $targetPhone]); // } // // private function createUserWithPermission(): User // { // return User::factory() // ->has(Permission::factory([ // 'name' => 'manage_calls', // 'name_fa' => 'مدیریت تماس‌ها', // ])) // ->create(); // } //}