$this->assertEqual($q->getQuery(),"SELECT e.id AS e__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE e2.name = 'some group' AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");
$this->assertEqual($q->getQuery(),"SELECT e.id AS e__id FROM entity e LEFT JOIN groupuser g ON e.id = g.user_id LEFT JOIN entity e2 ON e2.id = g.group_id WHERE e2.name = 'some group' AND (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");