Cake 2x upgrade, with tests

I upgraded this plugin to Cake 2x and fixed unit tests, also tidyed code to official standards