Updates conditional, replaces die() with Exception

Adds phpunit as dev dependency and adds a unit test
Merge pull request #1 from jeremykendall/tests

Updates conditional, replaces die() with Exception