Qual: Add phpunit tests for margin lib