The Prophet ﷺ said, "When a faithful believer is made to sit in his grave, then (the angels) come to him and he testifies that none has the right to be worshipped but Allah and Muhammad is Allah's Apostle. And that corresponds to Allah's statement: Allah will keep firm those who believe with the word that stands firm . . . (14.27). Narrated Shu'ba: Same as above and added, "Allah will keep firm those who believe . . . (14.27) was revealed concerning the punishment of the grave."
عَنِ النَّبِيِّ ﷺ قَالَ إِذَا أُقْعِدَ الْمُؤْمِنُ فِي قَبْرِهِ أُتِيَ ثُمَّ شَهِدَ أَنْ لاَ إِلَهَ إِلاَّ اللَّهُ وَأَنَّ مُحَمَّدًا رَسُولُ اللَّهِ فَذَلِكَ قَوْلُهُ {يُثَبِّتُ اللَّهُ الَّذِينَ آمَنُوا بِالْقَوْلِ الثَّابِتِ} حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ حَدَّثَنَا غُنْدَرٌ حَدَّثَنَا شُعْبَةُ بِهَذَا وَزَادَ {يُثَبِّتُ اللَّهُ الَّذِينَ آمَنُوا} نَزَلَتْ فِي عَذَابِ الْقَبْرِ