Question: What is the best way to test production only config files before they are deployed to produciton?

The config files for non production environment could get easily tested in their respective environments. But how can be production environment tested before production deployment happens?

For example, the DB name in STAGE is different than the DB name in prod. 

What if STAGE config file has correct DB name and is tested okay. Now, the prod config file has "typo" in the config file. This typo will not be discovered until its deployed in production. 

Is there a way to test this config file with typo error before it goes to production?

thanks

Answer: 
The method some use is to have a Staging environment which is identical in every way to your production environment.

You can test in an as-near-as-possible Production environment before going completely live with the solution.
Probably the best way to achieve this is create a separate web site in your production environment as a "stage". Then you can roll your new config to this site first to test it and if everything looks OK migrate it over to your real production site. Otherwise, you can't be guaranteed it will behave the same as being on your production server.