As teacher, create a quiz and set a time limit, close date and set When time expires to Allow a grace period to submit, but not change any responses. Set Submission grace period to a suitable amount of time to let you do the tests below.
PLEASE NOTE: the time limit must be long enough so that it does not expire before the end date.
1. As a student, start a quiz attempt and answer some questions. Then log out of Moodle. The quiz cron has not run yet.
2. Wait until the end date of the quiz has expired but the time limit has not.
3. The quiz cron runs.
4. Log in as teacher, and you will be able to see that the attempt has been updated to be Overdue.
5. Login as a student and click the Continue last attempt button and you will be taken to the summary page, where you are told you can still submit up to a certain time.
6. Submit, and make sure your score is counted.