‘Abdullah bin ‘Umar (may Allah be pleased with them both) narrates from the Messenger of Allah (peace and blessings be upon him) that he said: Three men were traveling when a severe rain overtook them, so they took shelter in a cave of a mountain. Meanwhile, a rock fell from the mountain and blocked the mouth of the cave. They said to one another: Think of your righteous deeds which you have done for Allah’s sake, and supplicate to Him by means of those deeds; perhaps Allah will remove this rock for you.
So one of them said: My parents were old and weak, and I had a wife and small children. I used to graze sheep and goats for them. When I would return in the evening after grazing, I would milk the animals and begin with my parents, giving them to drink before my children. One day, a tree took me far away (i.e., I found pasture very far), so I did not return home until evening, and I found my parents asleep. I milked as usual and stood by their heads with the milk. I disliked to wake them from their sleep, and I disliked to give my children before them. The children were crying at my feet out of hunger. So my and their condition remained like this until morning (i.e., I stood all night with the milk waiting for them to wake, and the children kept crying; neither did I drink nor did I give to the children). O Allah! If You know that I did this for Your pleasure, then open a way through this rock so that we may see the sky. So Allah opened it a little, and they saw the sky through it.
The second said: O Allah! The matter is that I had a cousin whom I loved as a man loves a woman (i.e., I was extremely in love with her). I inclined towards her and desired her (i.e., intended to commit fornication). She refused and said: I will not agree unless you give me one hundred dinars. I strove and collected one hundred dinars and brought them to her. When I sat with her for the sexual act (i.e., with the intention of intercourse), she said: O servant of Allah! Fear Allah and do not break the seal unlawfully (i.e., do not take my virginity without marriage). So I got up from her. O Allah! If You know that I did this for Your pleasure, then open the cave a little more. Allah opened it a little more (i.e., the opening became larger).
The third said: O Allah! I hired a man for a faraq (a vessel that holds sixteen ratl of grain) of rice as wages. When he finished his work, he said: Give me my due. I placed the faraq of rice before him, but he did not take it. I sowed those grains (and there was blessing in it), until I gathered from that wealth cows, oxen, and their shepherds. Then that laborer came to me and said: Fear Allah and do not withhold my right. I said: Go and take the cows, oxen, and their shepherds. He said: Fear Allah (the Compeller) and do not mock me. I said: I am not mocking; take the cows, oxen, and the shepherds. So he took them. O Allah! If You know that I did this for Your pleasure, then open what remains. So Allah opened the remaining mouth of the cave (and they came out of the cave).