def METHOD_NAME(
    caplog, min_epochs, min_steps, current_epoch, early_stop, fit_loop_done, raise_debug_msg
):
    """Test that checks that debug message is logged when users sets `should_stop` and min conditions are met."""
    trainer = Trainer(min_epochs=min_epochs, min_steps=min_steps, limit_val_batches=0, max_epochs=100)
    trainer.fit_loop.max_batches = 10
    trainer.should_stop = True
    trainer.fit_loop.epoch_loop.automatic_optimization.optim_progress.optimizer.step.total.completed = (
        current_epoch * trainer.num_training_batches
    )
    trainer.fit_loop.epoch_loop.batch_progress.current.ready = 10
    trainer.fit_loop.epoch_progress.current.processed = current_epoch
    message = "`Trainer.fit` stopped: `trainer.should_stop` was set."
    with caplog.at_level(level=logging.DEBUG, logger="lightning.pytorch.utilities.rank_zero"):
        assert trainer.fit_loop.done is fit_loop_done
    assert (message in caplog.text) is raise_debug_msg
    assert trainer.fit_loop._can_stop_early is early_stop