The situation passed last September during a Transavia commercial flight connecting Hurghada (Egypt) to Amsterdam (Netherlands). During flight the Captain felt the call of Mother Nature and went out of the cockpit to relief the pressure and right after leaving the toilet when tried to return to the cockpit the door was locked and none was responding from the inside. The First Officer fell asleep.
Here is the website of the aviation herald with the details of this unusual episode but really reminding the thematic of the previous post. http://avherald.com/h?article=45cd431c&opt=0