As teacher, create a quiz and set a close date but DO NOT set a time limit 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.
1. As student, start a quiz attempt and answer some questions. Then lot out of Moodle.
2. Wait until the close date/time has expired, but before the Quiz cron has run, then log back in as a teacher, and confirm that the attempt is still shown as In-progress.
3. Log in as a student, and go to the quiz info page. This will cause the quiz attempt to be automatically moved to the Overdue state.
4. 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.
5. Do not submit the attempt, wait for the grace period to expire.
6. Confirm that the score is not counted and that the quiz attempt is set to "Never submitted".
7. Login as teacher and check that that the attempt is set to "never submitted" and has not been graded.