Resolve PHPUnit test fails/errors, fix disceprencies in code implementation.