Rock Out With Your Mock Out: Using the PHPUnit at() Method

Having established how to create mock methods with stubs that run multiple times, I was pretty certain that I had finally slain the unit testing dragon, was king of the PHPUnit castle and a lifetime of finely tested code and buxom wenches awaited me (because buxom wenches go weak at the knees for well tested … Continue reading Rock Out With Your Mock Out: Using the PHPUnit at() Method

Advertisements

SSH Keys, Bitbucket and SourceTree on MAC – A Ménage à Trois of Misery

Ok so the title is a little dramatic, but I had just run the same provisioning script multiple times only to have it fail when trying to clone a Bitbucket GIT repository. Luckily I resolved everything, which is why I am here chirpily regaling you with my story instead of picking up bits of smashed … Continue reading SSH Keys, Bitbucket and SourceTree on MAC – A Ménage à Trois of Misery

PHPUnit stubs methods that run more than once.

Another day, another PHPUnit revelation. Yesterday some code started returning an internal server error. In true developer fashion, I ran the same process several times and was absolutely staggered to find that the same thing happened every time. No amount of hard refreshing or cache clearing would help. I considered phoning the server hosting company … Continue reading PHPUnit stubs methods that run more than once.

Vagrant Too many open files – getcwd

My rule-of-thumb approach to issues in terminal is to kill the process, quit terminal and restart my MAC. If that fails, I call an exorcist and retire to a safe distance and assume the recovery position. Recently I've occasionally been getting the following error when running "vagrant up": vagrant /opt/vagrant/embedded/gems/gems/vagrant-1.9.2/lib/vagrant/util/safe_chdir.rb:25:in `chdir': Too many open files … Continue reading Vagrant Too many open files – getcwd

Parsing $_POST variables and arrays with filter_input_array, filter input and FILTER_CALLBACK

Another day, another PHP Codesniffer induced solution to some code that worked fine before, but I just couldn't leave it alone once Codesniffer scolded me. This time it was: Detected access of super global var $_POST, probably needs manual inspection No problem. I've used filter_input before, lets do this. First problem, I'm dealing with an … Continue reading Parsing $_POST variables and arrays with filter_input_array, filter input and FILTER_CALLBACK

Using the same login for two different WordPress sites on the same domain

Consider this scenario. You have a WordPress site with a large user base set up on a domain. Lets call it iwishicouldcodebetter.com (because test.com and example.com are already taken). Over time you get sick of answering emails asking you how to use your site. You add a documentation site at documents.iwishicouldcodebetter.com and fill it with … Continue reading Using the same login for two different WordPress sites on the same domain