Fixes #5167 - Setup Elgg install on Travis

That PR needs some cleanup and review. It successfully runs simpletest suite on Travis, but core required some modifications and bugfixes + one tests modification that I'd appreciate if someone took a look at.

There's mess in commits, I'll do some squasing to clean this up.