The Prophet ﷺ said, "When the believer is seated in his grave, he is brought forth and bears witness that there is no god but Allah and that Muhammad is the Messenger of Allah ﷺ. That is the meaning of His saying, 'Allah keeps firm those who believe with the firm word' [Ibrahim 14:27]."
عن النبي ﷺ قال: إذا أقعد المؤمن في قبره، أتي ثم شهد أن لا إله إلا الله وأن محمدا رسول الله ﷺ فذلك قوله: {يثبت الله الذين آمنوا بالقول الثابت} [إبراهيم: ٢٧].
Bukhari narrated it in Janaiz (1369) from Hafs bin Umar, who said, Shuba narrated to us, from Alqama bin Marthad, from Saad bin Ubayda, from Bara bin Azib, and he related it.Muslim narrated it in Jannah (2871) through several routes from Muhammad bin Jafar Ghundar, from Shuba with his chain, that the Prophet ﷺ said, "Allah confirms those who believe with a firm word" was revealed concerning the punishment of the grave. He will be asked, "Who is your Lord?" and he will say, "My Lord is Allah, and my Prophet is Muhammad ﷺ." That is the meaning of His saying , "Allah confirms those who believe with a firm word in this worldly life and in the hereafter" [Ibrahim 14:27].Bukhari narrated it in Tafsir (4699) from Abu Walid, from Shuba with his chain, that the Messenger of Allah ﷺ said, "The Muslim, when questioned in the grave, testifies that there is no god but Allah and that Muhammad is the Messenger of Allah, and that is the meaning of His saying, "Allah confirms those who believe with a firm word in this worldly life and in the hereafter" [Ibrahim 14:27]."