عن أنس رضي الله عنه قال‏:‏ مروا بجنازة، فأثنوا عليها خيراً، فقال النبي صلى الله عليه وسلم الله عليه وسلمى الله عليه وسلم الله عليه وسلم ‏:‏ ‏"‏وجبت”، ثم مروا بأخرى، فأثنوا عليها شراً، فقال النبي صلى الله عليه وسلمى الله عليه وسلم الله عليه وسلم الله عليه وسلم ‏:‏ ‏"‏وجبت‏"‏ فقال عمر بن الخطاب رضي الله عنه‏:‏ ما وجبت‏؟‏ قال‏:‏ ‏"‏هذا أثنيتم عليه خيراً، فوجبت له الجنة، وهذا أثنيتم عليه شراً فوجبت عليه النار، أنتم شهداء الله في الأرض” ‏(‏‏(‏متفق عليه‏)‏‏)‏‏.‏
Copy
Abul-Aswad (May Allah be pleased with him) reported

I came to Al- Madinah, and while I was sitting beside 'Umar bin Al-Khattab, a funeral procession passed by. The people praised the deceased, and 'Umar bin Al-Khattab said: "He will certainly enter it." Then another funeral procession passed by and the people praised the deceased. 'Umar bin Al-Khattab (May Allah be pleased with him) said: "He will certainly enter it." A third funeral procession passed by and the people spoke ill of the deceased. He said: "He will certainly enter it." I (Abul-Aswad) asked: "O Amir Al-Mu'minin (i.e., Leader of the Believers)! What do you mean by 'He will certainly enter it'?" He replied: "I said the same as was said by the Prophet (ﷺ). He (ﷺ) said, 'If four persons testify the righteousness of a Muslim, Allah will grant him Jannah.' We asked: 'If three persons testify his righteousness?' He (ﷺ) replied, 'Even three'. Then we asked: 'If two?' He (ﷺ) replied, 'Even two.' We did not ask him (regarding the testimony) of one."[Al-Bukhari].