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.
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
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
I don’t know what I am from a development point of view. I started out as a front-end developer, but one that had the design skills akin to Donald Trump’s abilities in the art of tact, wit and diplomacy. I quickly left the design to other people and developed a vast array of IE6 hacks … Continue reading Repairing a Variable VVV Install
In an attempt to shape myself into a poster boy for "Best Practice WordPress Development", I've faithfully installed, Vagrant, I write unit tests and I run Codesniffer on all the new code I write (and am painstakingly refactoring old code at the same time). On a recent job, a quick run of Codesniffer produced (among … Continue reading Testing values filtered with filter_input with PHPUnit
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
Having mastered the ability to cause time to stand still, the next challenge I faced while writing what are probably technically not unit tests, was a lack of direction, or rather too much direction. Consider something like this: So far so good, if the user has the correct capabilities they can view the page. If … Continue reading Testing methods that redirect with PHPUnit
Over the last year or so, I've discovered the wonderful world of Unit Testing. In a slightly verbose nutshell, Unit Testing involves: Trying to get PHPUnit installed (considerably easier for me on VVV than XAMPP btw) Finally getting it to work, but not quite being sure how. Reading some tutorials that get you up to … Continue reading Overriding time() when unit testing with PHPUnit