function yourfunction($a,$z){
if($a<$z){ throw new <YOUR_EXCEPTION>; }
}
here is the test
class FunctionTest extends \PHPUnit_Framework_TestCase{
public function testException(){
$this->setExpectedException(<YOUR_EXCEPTION>::class);
yourfunction(1,2);//add vars that cosecause the exception
}
}