An optical chip for self-testing quantum random number generation