Minor fixes
Add some PHPUnit tests