Jmrtech's avatar

Test Twiml response

I am trying to write test for some of my routes which have twilio actions attached to them. When a POST request is made it then echoes a twiml(xml) response. If I visit the site then all works as expected. Twiml document is rendered properly. I am new to testing and hope that someone will be able to shed some light.

$response = $this->call('POST', '/incomingsms', $params);

        $this->assertXmlStringEqualsXmlString(testTwiml($message), $response->getContent());

The method below is the last thing that is called from the controller for the route

public function responseToIncomingSms($body)
    {
        $response = new Services_Twilio_Twiml();
        $response->message($body);
        echo $response;
    }
0 likes
0 replies

Please or to participate in this conversation.