Ejemplo n.º 1
0
 /** @test */
 function it_creates_the_data_for_the_post_request()
 {
     $method = $this->getProtectedMethod(Messenger::class, 'createDataForRequest');
     $messageData = $this->message->buildMessage();
     $result = $method->invokeArgs($this->messenger, [$messageData, $this->recipient]);
     $this->assertEquals(['form_params' => ['recipient' => ['id' => 123456789], 'message' => ['text' => 'Some title']]], $result);
 }
Ejemplo n.º 2
0
 /** @test */
 function it_creates_a_message_with_mulitple_buttons()
 {
     $data = [['Button 1', 'web_url', 'https://google.com'], ['Button 2', 'postback', 'postback'], ['Button 3', 'web_url', 'https://github.com']];
     foreach ($data as $button) {
         $this->message->button($button[0], $button[1], $button[2]);
     }
     $property = $this->getProtectedProperty(Message::class, 'buttons');
     $buttons = $property->getValue($this->message);
     $this->assertCount(3, $buttons);
 }
Ejemplo n.º 3
0
 public function send(Message $message, $recipient)
 {
     $data = $this->createDataForRequest($message->buildMessage(), $recipient);
     return $this->doRequest($data);
 }