Example #1
0
 /**
  * @covers spriebsch\MVC\ViewHelper\FormErrors
  */
 public function testSeparatesTwoMessagesWithBrTag()
 {
     $request = $this->getMock('\\spriebsch\\MVC\\Request');
     $response = new Response();
     $error = new \spriebsch\MVC\Message\FormError('message', 'form');
     $response->addMessage($error);
     $error = new \spriebsch\MVC\Message\FormError('another', 'form');
     $response->addMessage($error);
     $formErrors = new \spriebsch\MVC\ViewHelper\FormErrors($request, $response);
     $this->assertEquals('<div class="error">message<br>another</div>', $formErrors->execute(array('form')));
 }
Example #2
0
 public function testMessages()
 {
     $resource = $this->prophesize(Resource::CLASS);
     $resource->addSuccessMessage('success')->shouldBeCalled();
     $resource->addInfoMessage('info')->shouldBeCalled();
     $resource->addWarningMessage('warning')->shouldBeCalled();
     $resource->addErrorMessage('error')->shouldBeCalled();
     $resource->addMessage(MessangerInterface::MESSAGE_INFO, 'custom')->shouldBeCalled();
     $response = new Response($resource->reveal());
     $response->addSuccessMessage('success');
     $response->addInfoMessage('info');
     $response->addWarningMessage('warning');
     $response->addErrorMessage('error');
     $response->addMessage(MessangerInterface::MESSAGE_INFO, 'custom');
 }
<?php

require_once 'plivo.php';
// Sender's phone numer
$from_number = $_REQUEST["From"];
// Receiver's phone number - Plivo number
$to_number = $_REQUEST["To"];
// The SMS text message which was received
$text = $_REQUEST["Text"];
// Output the text which was received, you could
// also store the text in a database.
echo "Message received from {$from_number} : {$text}";
$params = array('src' => $to_number, 'dst' => $from_number);
$body = "Thank you for your message.";
// Generate a Message XML with the details of
// the reply to be sent.
$r = new Response();
$r->addMessage($body, $params);
Header('Content-type: text/xml');
echo $r->toXML();
?>

<!--
Sample Output
Message received from 3333333333 : Hello, from Plivo
<Response>
   <Message dst="2222222222" src="1111111111">Thank you for your message</Message>
</Response>
-->