function let(ServerRequestInterface $request, StreamInterface $stream, EventDispatcherInterface $dispatcher)
 {
     $payload = '
     {
       "object": "page",
       "entry": [
         {
           "id": "PAGE_ID",
           "time": 1473204787206,
           "messaging": [
             {
               "sender":{
                 "id":"USER_ID"
               },
               "recipient":{
                 "id":"PAGE_ID"
               },
               "timestamp":1458692752478,
               "message":{
                 "mid":"mid.1457764197618:41d102a3e1ae206a38",
                 "seq":73,
                 "text":"hello, world!",
                 "quick_reply": {
                   "payload": "DEVELOPER_DEFINED_PAYLOAD"
                 }
               }
             }   
           ]
         }
       ]
     } 
     ';
     $stream->__toString()->willReturn($payload);
     $signature = XHubSignature::compute($payload, 'secret');
     $request->getBody()->willReturn($stream);
     $request->getHeader('X-Hub-Signature')->willReturn(['sha1=' . $signature]);
     $this->beConstructedWith('secret', 'verify_token', $request, $dispatcher);
 }
Example #2
0
 public function testNullToString()
 {
     $this->assertSame('', $this->stream->__toString());
 }
 public function __toString()
 {
     return $this->stream->__toString();
 }
Example #4
0
 /**
  * @return string
  */
 public function __toString()
 {
     return $this->responseData->__toString();
 }
 function it_returns_an_APOD_object_with_the_same_date_the_response_has(Client $httpClient, ResponseInterface $response, StreamInterface $responseBodyStream)
 {
     $date = '2016-01-01';
     $responseBody = $this->defaultResponseBody;
     $responseBody['date'] = $date;
     $responseBodyStream->__toString()->willReturn(json_encode($responseBody));
     $response->getBody()->willReturn($responseBodyStream);
     $apod = $this->get();
     $datetime = $apod->getDateTime();
     $datetime->format('Y-m-d')->shouldBe($date);
 }
Example #6
0
 public function withBody(StreamInterface $body)
 {
     $this->body = $body->__toString();
     return $this;
 }