def METHOD_NAME(tmp_dir, dvc, run_copy, mocker):
    tmp_dir.gen("foo", "foo")
    assert not os.path.exists(dvc.stage_cache.cache_dir)
    run_copy("foo", "bar", name="copy-foo-bar")
    assert _recurse_count_files(dvc.stage_cache.cache_dir) == 1
    tmp_dir.gen("foo", "foobar")
    run_copy("foo", "bar", name="copy-foo-bar")
    assert _recurse_count_files(dvc.stage_cache.cache_dir) == 2
    from dvc.stage import run as _run
    mock_restore = mocker.spy(dvc.stage_cache, "restore")
    mock_run = mocker.spy(_run, "cmd_run")
    (tmp_dir / "bar").unlink()
    (tmp_dir / LOCK_FILE).unlink()
    (stage,) = dvc.reproduce("copy-foo-bar")
    assert (tmp_dir / LOCK_FILE).exists()
    assert (tmp_dir / "bar").read_text() == "foobar"
    mock_run.assert_not_called()
    mock_restore.assert_called_once_with(stage, dry=False)
    mock_restore.reset_mock()
    (tmp_dir / LOCK_FILE).unlink()
    tmp_dir.gen("foo", "foo")
    dvc.reproduce("copy-foo-bar")
    assert (tmp_dir / "bar").read_text() == "foo"
    mock_run.assert_not_called()
    mock_restore.assert_called_once_with(stage, dry=False)
    assert (tmp_dir / "bar").exists()
    assert not (tmp_dir / "foo").unlink()
    assert (tmp_dir / LOCK_FILE).exists()