If you have a PHP application that makes heavy use of objects (which is probably
95% of you reading this) then you will have objects with constructor methods
in them. It is also very likely that there is some stuff going on in those
constructors. So how do you test things like this?

The magic method here is assertAttributeEquals(). It lets you check the value
inside any protected or private class attributes, which is absolutely a
requirement in this example. It is probably better to have some other
publicly-available methods that can return us the protected (or in some
cases private because you don't want anyone to manipulate them) attributes.

Videos

It’s the next best thing to me teaching you one-on-one how to become better at testing your code!
The “PHP Bootcamp Sessions” Videos are now available at Grumpy Learning.
3+ hours of instruction in DRM-free 640x480 MP4 for just $99.

Development Hell

Check out the podcast I do with Ed Finkler
where we do a free-flowing, unedited talk about various programming topics.