Unit tests, fixes and #2

I spent some time with your module to get more confortable with the yii unit tests and then also implemented my request in issue #2. 
Im sure there are some optimisations which could be done (especially for the lazy loading on write) but i couldnt come up with a better solution for now.