about me about me
photography photography
software projects software projects
contact me contact me

This might sound heavy handed and radical but it’s widely accepted, particularly among the testing community that statics are evil. Specifically I’m referring to static properties and methods, with exception to self for late static binding and parent used in inheritance.

At first glance, statics are a convenience but as your code base grows, and especially if you try to write unit tests around your code, the convenience turns into pain. Why?
Read the rest of this entry »


PHP UK Conference 2012

posted 2012 // conference, php // 0

This was the third consecutive year I’ve attended the PHP UK conference. I bought a ticket for Friday only (this is the first year PHP UK has spanned two days). While I think the event is better organised every year, the quality of the talks for 2012, overall, was not the same standard as last year (with exception to Ian B’s, who’s always good).
Read the rest of this entry »

When writing unit tests, it’s often useful to know the code coverage you’ve achieved to see what proportion of your code you’re exercising. Typically you have to commit your code to version control, so your CI server can pull in your updates and produce coverage reports. This means you sometimes commit incomplete tests, where you might forget to test failure branches (throwing exceptions for example).

code coverage report

Read the rest of this entry »

I occasionally need the list of method parameter matchers when setting assertions via mocks using with(). A completely useless example:


Read the rest of this entry »

Maybe that end part, doesn’t get object oriented design is a bit sensationalist. Don’t get me wrong, I have a lot of respect for Joel. He speaks a lot of sense, his blog and books are testament to that … I own a few of them.

I might be a couple of years late on this … it wasn’t until I was researching an answer to a question on the Stack Exchange Programmers site about test driven design that I stumbled across this blog post by Robert Martin.

So I listened to episode 38 of the StackOverflow podcast, and figured Joel might have said the things he did to stir things up a bit, and light a fire of conversation for the podcast. More Googling lead me to other evidence that he thinks unit testing is a time waster.
Read the rest of this entry »

I originally added this to Wikipedia’s Luhn algorithm page but one of their editors deemed there to be too many language implementations, and so they scrubbed it.

I’m posting it here for other PHP programmers, this might save you a few minutes work.
Read the rest of this entry »