Can we see the test please?
Dec 11, 2015
4
Level 2
Integration test for twilio autoresponder
I have an application that uses twilio for a sms autoresponder. I'm running into trouble with setting the test up. Here is part of incomingsms.php:
public function smsResponse($response, Request $request, $client)
{
switch ($response) {
case '1':
$message = "Text the word refill to start a prescription request.";
$this->twilio->responseToIncomingSms($message);
break;
case '2':
$message = "Text the word food to start a food order request.";
$this->twilio->responseToIncomingSms($message);
break;
default:
$message = "Text menu for options or help to unsubscribe.";
$this->twilio->responseToIncomingSms($message);
}
}
Here is the response to incoming function:
public function responseToIncomingSms($body)
{
$response = new Services_Twilio_Twiml();
$response->message($body);
echo $response;
}
I'm not sure if part of the problem is the fact that twilio just echo's rather than return. If I have to test it manually I can but I was just trying to find a way to incorporate this with the other test I'm doing. Thanks
Please or to participate in this conversation.