If you fail an Ap class but pass the test, do you still get the credit?

Asking for a friend