PHPUnit tests

Added functional unit test