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

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:

$foo->expects($this->once())
    ->method('setter')
    ->with($this->isType('string'));

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 »

Recently I tried to replace one line with multiple lines of text using Netbeans. As much as Netbeans IDE is growing on me (having recently switched from Eclipse), I couldn’t accomplish this multi-file, multi-line replace with it (yes I know about Edit > Replace in Projects… that didn’t work). I turned to bash for a solution …
Read the rest of this entry »

I needed to compile the latest PHP5 from source so I could enable FPM support. The following packages needed installing to successfully complete compilation. Read the rest of this entry »