X owner Elon Musk has agreed to testify in a Securities and Exchange Commission investigation into the billionaire’s purchase of Twitter in 2022.