dongun's avatar
Level 15

How to test a helper function that returns a response()->json()

I have this function that's a blueprint for responses for my ajax requests, and I don't know how to write a test for it. Please, how do I write a test for this.

function apiSuccess(string $msg, $data)
{

    $responder = [
        'status' => 0,
        'message' => $msg,
        'data' => $data
    ];

    return response()->json( $responder );
}
0 likes
0 replies

Please or to participate in this conversation.