Say if he doubted a child is his can he get a test done or is it up to the mother? Does a man need a woman's consent?

Is it different for a child who is born and a pregnant woman's fetus? So the rights differ if it's a pregnancy and if it's after birth?
@pearl - no I'm taking about if a man wants to get a test done, can he get it done. I know women have all the rights already.