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); }