Sample unit tests with PHPUnit

See #52.

These are sample unit tests. Includes code from #121, and tests for that code.