The MUSE Hubble Ultra Deep Field Survey. III. Testing photometric redshifts to 30th magnitude