Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Chris Hartjes' Blog:
Metatesting: Testing Constructors
Apr 06, 2012 @ 13:28:00

In a new post to his blog Chris Hartjes, promoter of all things testing, looks a a method for testing constructors - an effective way to validate the things that happen when your objects are generated.

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?

He includes a sample constructor that creates a container, pulls out some configuration values and reassigns them to class properties. He first tests that these properties have been set correctly by mocking out the object and overriding the configuration settings in the (dependency injection) container.

tagged: testing constructors unittest mock object properties

Link:

Stefan Mischook's Blog:
Object Oriented PHP Tutorial Updated
Aug 28, 2007 @ 13:49:00

Stefan Mischook has once again updated his beginner tutorial to help new developers to PHP get acquainted with working with objects in PHP.

I’ve update my beginners tutorial on object oriented PHP adding steps 12-17. I cover two new basic OO concepts in these steps: Constructors and Access modifiers.

The fully updated tutorial can be found here on Stefan's website.

tagged: oop object programming tutorial update constructors access modifiers oop object programming tutorial update constructors access modifiers

Link:

Stefan Mischook's Blog:
Object Oriented PHP Tutorial Updated
Aug 28, 2007 @ 13:49:00

Stefan Mischook has once again updated his beginner tutorial to help new developers to PHP get acquainted with working with objects in PHP.

I’ve update my beginners tutorial on object oriented PHP adding steps 12-17. I cover two new basic OO concepts in these steps: Constructors and Access modifiers.

The fully updated tutorial can be found here on Stefan's website.

tagged: oop object programming tutorial update constructors access modifiers oop object programming tutorial update constructors access modifiers

Link:


Trending Topics: