David Pecker, former publisher of The National Enquirer, testified that Donald J. Trump thanked him for burying stories.