def METHOD_NAME(filename, tags_to_apply, get_configuration,
                                    configure_environment, restart_syscheckd, wait_for_fim_start):
    '''
    description: Check if the 'wazuh-syscheckd' daemon detects 'modified' and 'deleted' events when modifying
                 files that exist before the Wazuh agent is started. For this purpose, the test will modify
                 the testing file, change the system time to the next scheduled scan, and verify that
                 the proper FIM event is generated. Finally, the test will perform
                 the above steps but deleting the testing file.
    wazuh_min_version: 4.2.0
    tier: 0
    parameters:
        - filename:
            type: str
            brief: Name of the testing file to be modified.
        - tags_to_apply:
            type: set
            brief: Run test if match with a configuration identifier, skip otherwise.
        - get_configuration:
            type: fixture
            brief: Get configurations from the module.
        - configure_environment:
            type: fixture
            brief: Configure a custom environment for testing.
        - restart_syscheckd:
            type: fixture
            brief: Clear the 'ossec.log' file and start a new monitor.
        - wait_for_fim_start:
            type: fixture
            brief: Wait for realtime start, whodata start, or end of initial FIM scan.
    assertions:
        - Verify that FIM events of type 'modified' and 'deleted' are generated
          when files that exist before starting the Wazuh agent are modified.
    input_description: A test case (ossec_conf) is contained in external YAML file (wazuh_conf.yaml)
                       which includes configuration settings for the 'wazuh-syscheckd' daemon and, it
                       is combined with the testing directories to be monitored defined in this module.
    expected_output:
        - r'.*Sending FIM event: (.+)$' ('modified' and 'deleted' events)
    tags:
        - scheduled
        - time_travel
    '''
    check_apply_test(tags_to_apply, get_configuration['tags'])
    scheduled = get_configuration['metadata']['fim_mode'] == 'scheduled'
    mode = get_configuration['metadata']['fim_mode']
    # Modify file
    modify_file_content(testdir1, filename, new_content='Sample content')
    # Expect modified event
    check_time_travel(scheduled, monitor=wazuh_log_monitor)
    modified_event = wazuh_log_monitor.start(timeout=timeout, callback=callback_detect_event,
                                             error_message='Did not receive expected '
                                                           '"Sending FIM event: ..." event').result()
    assert 'modified' in modified_event['data']['type'] and \
           os.path.join(testdir1, filename) in modified_event['data']['path']
    validate_event(modified_event, mode=mode)
    # Delete file
    delete_file(testdir1, filename)
    # Expect deleted event
    check_time_travel(scheduled, monitor=wazuh_log_monitor)
    deleted_event = wazuh_log_monitor.start(timeout=timeout, callback=callback_detect_event,
                                            error_message='Did not receive expected '
                                                          '"Sending FIM event: ..." event').result()
    assert 'deleted' in deleted_event['data']['type'] and \
           os.path.join(testdir1, filename) in deleted_event['data']['path']
    validate_event(deleted_event, mode=mode)