“Do I not have the right that you should listen to me and obey?” They said: “Yes.” He said: “And if I command you to do something, will you not do it?” They said: “Of course.” He said: “Then I command you to jump into this fire.” Some people got up and got ready to jump, and when he saw that they were about to jump, he said: “Restrain yourselves, for I was joking with you.” When we came to Al-Madinah, they mentioned that to the Prophet (ﷺ), and the Messenger of Allah (ﷺ) said: “Whoever among you commands you to do something that involves disobedience to Allah, do not obey him.”
Sunan Ibn Majah Book 24, Hadith 111