w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Redirect database connection on PHPUnit test

use sed

it is pretty much a preg replace that searches inside of files that you specify. this is how you would use it on your box

sed -i 's/proddatabase.expensivebusiness.com/devdatabase.expemsivebusiness.com/g' *.php

I have a shell script that goes through all prod files and puts dev labels (floating notifications, changes database addresses and replaces usernames/passwords with testing ones if necessary). make a script, put it into your bin, and just type 'dev' or 'prod' in terminal to switch between dev and prod values... unless you want have both dev and prod code in your php, then you just need to re-evaluate your approach and use simple vim preg-replace for time being.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.