Allah says in the Quran, “And We will surely test you with something of fear and hunger and a loss of wealth and lives and fruits, but give good tidings to the patient, Who, when disaster strikes them, say, ‘Indeed we belong to Allah, and indeed to Him we will return.’ Those are the ones upon whom are blessings from their Lord and mercy. And it is those who are the [rightly] guided” (Quran 2:155-157). This life is a test, hence, Muslims know that they will be tested by Allah, and in fact, Allah tests those whom He loves the most. The Prophet PBUH said, “If Allah loves a people, then he afflicts them with trials. Whoever is patient has the reward of patience, and whoever is impatient has the fault of impatience” (Musnad Ahmad 23122). A clear proof for this is that when one looks at the lives of the Prophets and Messengers, they had some of the hardest lives and were tested in many things, despite them being the closest and most beloved by Allah. If the love of God was based on materialistic success in this world, then the Prophets and Messengers should have been all wealthy kings who ruled the earth. Rather, just because a person is given everything in this world doesn’t mean Allah loves them, and just because a person is given almost nothing in this world doesn’t mean Allah hates them, because this life is only a test and it is not the real life. To conclude, Allah says in the Quran, “Be not deceived by the [uninhibited] movement of the disbelievers throughout the land. [It is but] a small enjoyment; then their [final] refuge is Hell, and wretched is the resting place. But those who feared their Lord will have gardens beneath which rivers flow, abiding eternally therein, as accommodation from Allah. And that which is with Allah is best for the righteous” (Quran 3:196-198).
And Allah knows best.