Salaam,
I swear the only reason this mail caught my eye was because you have the same name as my nephew!
You can take the life in the UK test anytime. I suggest you take it NOW. You can take it from the moment you arrive to the UK, if I were you I would go to my local college and book a test. When your 2years is nearly up then you should (inshallah) have your certificate and then you can apply for your indefinate leave to remain, otherwise if you dont have the certificate you will have to apply for the further leave to remain.
Hope this helps