2018
-
Deterministic Random Numbers in PHP
Jan 5
Testing code that leverages random numbers can be tricky. It’s useful to have a way to subvert the random number generator during tests to yield a deterministic state.
-
Mocking Time in Unit Tests
Jan 4
Some operations in PHP introduce uncertainty around your code’s behavior. In those situations, it’s helpful to insert helper functions that make your code more reliable and easier to test.
2014
-
Keep Your Environment Clean
Nov 8
I run a streamlined, sandboxed development environment to keep my system clean. It changes the way I structure projects – for the better!
-
TDD: Proof of Life
Oct 23
Unit testing and test-driven development are both very much alive.
-
Testing Responsive Websites
Sept 4
Developers claim to build responsive, mobile-friendly websites. But do we actually take the time to test and maintain them?
-
It’s a Dirty Job …
Jun 7
I insist that everyone on my team reviews code, and that everyone’s code goes through review before it hits the server. Two sets of eyes are always better than one.
-
Don’t Delay Dirty Dishes
May 21
The worst thing I remember about my old habits with dishes was how long it would take to do them when I finally got around to it.
-
Smallest Unit of Work
Apr 22
Whenever I try to explain unit testing to another developer, I refer to the “smallest unit of work” that’s possible to test.
-
JavaScript and Closures
Mar 27
One of the first things I look for when reviewing JavaScript code is the proper use (and isolation) of scope.
-
jQuery Portland – Unit Testing
Jan 16
Last year, I had the opportunity to present at jQuery Portland about unit testing. It was my first non-WordPress speaking event, and it was incredible!
2013
-
To Test or Not To Test: Unit Testing and Privacy
Dec 1
Determining which methods in your application needed testing used to be easy – test everything exposed by the public API. But once you invite other developers to contribute, you are exposing a whole other set of internal APIs to the team. The behavioral consistency of these methods is just as important as that of the…
-
Making Singletons Safe in PHP
Jan 7
Singletons are not inherently evil; just overused and implemented poorly. Here’s a way Singletons can be perfectly safe to use in PHP.