A rich merchant, transferred during sleep to the bed and palace of the Caliph Haroun-al-Raschid. Next morning he was treated as the caliph, and every effort was made to make him forget his identity. Arabian Nights, The Sleeper Awakened. The same trick was played on Christopher Sly, in the Induction of Shakespeare's comedy of Taming of the Shrew; and, according to Burton (Anatomy of Melancholy, ii. 2, 4), by Philippe the Good, Duke of Burgundy, on his marriage with Eleonora.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894