I've come up with two solutions for this problem:
First adding the mysql.sock to the test.php config:
'db'=>array(
'connectionString'=>'mysql:host=localhost;dbname=trackstar_dev;unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock',
'username'=>'root',
'password'=>'root',
'emulatePrepare'=>true
),
Second using the xampp php to run phpunit:
$ /pathtoxampp/bin/php phpunit /yourtestpath/