My WordPress TDD development setup – Windows version

Since I can’t always work on my main machine, a Mac, and am quite fond of my ThinkPad, I’ve setup my Windows machine as a near perfect replica of the Mac one. Listed below are the steps I’ve taken to do so.
One note: I make use of Windows Command Prompt extensively and I’m using it with administrator rights.

Installing MAMP and PHP

To run full-fledged installations of WordPress I choose WampServer. After downloading it installation is straight-forward.
WampServer comes with PHP bundled in it and I will add that version to Windows’ path, assuming I have installed WampServer into C:/wamp then run Command Prompt as an administrator and type

setx path "%path%;C:/wamp/bin/php/php5.4.16"

where php5.4.16 might be another version that came along with WampServer.
In the same Command Prompt I type

php -v

to test I’m using the PHP version that came with WampServer.

Installing pear

pear is a “PHP Extension and Application Repository” the name of which tells the tale. It does not come bundled with WampServer but if you have successfully installed PHP then installing pear just requires following the instructions for Windows installations reported on the official site. The only addendum here is that the file go-pear.phar does not come with WampServer so I download it and move it to C:/wamp/bin/php/php5.4.16 folder and then execute

php go-pear.phar

I follow along with pear installation and then test it entering

pear

At this point something went wrong and I got an error message about pear install directory. It might be just my case but the way I solved it was modifying C:/wamp/bin/php/php5.4.16/pear.bat file at line 53 from

set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"

to

set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%"

To test that pear has been successfully installed run

pear

Installing PHPUnit using pear

Following official site instructions if pear has been successfully installed then the simple commands:


pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

will do the trick. Once again I ran into some problems in this phase getting an error message from pear telling me


No releases available for package "pear.phpunit.de/PHPUnit"

install failed

thanks to this post on StackOverflow I solved the problem running


pear clear-cache
pear update-channels
pear install pear.phpunit.de/PHPUnit

To test that I’ve successfully installed PHPUnit I run


phpunit --version

at the Command prompt.

Installing Firefox, Selenium IDE and PHPUnit

Similar to my previous guide for the Mac version of the setup I did follow DragonBe’s instructions and will not repeat them.

Setting up MAMP to use Dropbox

What I’m trying to get here is to make WampServer point to my Dropbox virtual hosts folder in place of its default www folder. If I click WampServer icon once it’s launched and follow the link to www directory in a default WampServer installation C:/wamp/www will open. In my case I want WampServer to point instead to ~/Dropbox/path-to-my-virtual-hosts-folder.
To do so I first stop all WampServer services and then rename WampServer’s original wwww directory to www_original


REN "C:\wamp\www" "C:\wamp\www_original"

and then create a folder junction (a hardlink) to make www folder become a shortcut to my Dropbox virtual hosts folder


mklink /J C:\wamp\www C:\path-to-user-folder\path-to-my-virtual-hosts-folder

To test that the hardlink I try to create a new file or folder in C:\wamp\www folder and check if it shows up into Dropbpx virtual hosts folder.

Not syncing databases (still)

My setup ends here: in the past I’ve tried to keep WampServer and MAMP database folder in sync via Dropbox but the thing never went well and since I’m not adding anything but test content to local databases that doesn’t bother me very much. To initialize Windows version of MySQL database to use with WordPress I simply go over WordPress installation phase all over again on each machine or export the database from the machine already setup and import it in the one still to set. The latter procedure is the only way I know to have a working copy of a WordPress multi-site installation without having to fiddle too much.

Conclusion

The setup I described answers to my necessity to work on themes and plugins from anywhere and might not apply to anyone. The procedure to keep local sites in sync via Dropbox is a plus that will cost me nothing during setup but will be a real pain later. Happy coding.

I appreciate your input