Correct. I believe it has to be court-ordered and even then it's rare. DNA testing is also generally illegal unless for medical reasons. They claim this is to "uphold family peace" because "fatherhood is social, not biological". It seems incredibly wrong to me in that they are removing the father's right to choose whether to enter that social role when it is not biologically mandated.
Because I was once shocked to learn how easily it is in some countries (like Portugal) for a woman to have the court force a man to submit to a paternity test [0].
I also heard (I guess a few decades ago) the courts would start automatically an investigation on their own when no man would recognise a child at birth.
Protecting the kids I think, because if the dad is not known then the mother will have to pay for the child alone (subsidized by the government). In France around 3% of kids are raised from dads not knowing that they are not the biological father.
Personally I think this law is completely unfair but in practice I think the judges will not believe the one opposing the test.
You just can't order a test for someone else (your child) without their consent (so both parents, and a judge because parents don't have absolute rights over their children).
Courts order paternity tests just fine though when there is a reasonable doubt.
The people concerned can always refuse to be tested though.