haobangxiong
New Member
I'm trying to get into Unit testing for the obvious positives it introduces, and I'm trying to write a Unit test for a class I wrote the other day. (I know this is the opposite to TDD, please bear with me)My class, \[code\]Image\[/code\], is used in conjunction with some others for image manipulation. \[code\]Image\[/code\] essentially wraps a GD image resource and stores data along with it. For example, an instance of \[code\]Image\[/code\] will always contain it's current state, i.e. its new width/height if resized, the original image data, etc.The \[code\]Image\[/code\] class also contains methods for,
- Creating itself from a file, string data, or URL, e.g. \[code\]$image->loadFromPath()\[/code\]
- Creating a new GD image resource from the properties of the current \[code\]Image\[/code\] instance, e.g. for image resizing to maintain background transparency, etc.
- Cloning the GD image resource for use in the manipulation classes