Merge pull request #10 from ewinslow/travis-testing

Adds an actual test and refactors code slightly to make use of it.
Merge branch 'master' of https://github.com/ewinslow/elgg-HEART into travis-testing