This question might be but strange but does Allah swt test creations through dreams. Sometimes I have multiple phases in my own dreams where I have an opportunity to sin but I refrain from.