Beispiel #1
0
 /**
  * @depends testText
  */
 public function testMultipleText(MessengerBot $bot)
 {
     $bot->answer('foo', ['Jame', 'Annie']);
     $answers = $bot->getAnswers('text', 'foo');
     $this->assertCount(3, $answers);
     $this->assertEquals($answers, [['text' => 'Bar'], ['text' => 'Jame'], ['text' => 'Annie']]);
     return $bot;
 }
Beispiel #2
0
 public function testButtonWithAnotherText()
 {
     $bot = new MessengerBot();
     $button_template = $this->getSampleButton();
     $bot->answer('button', ['Rick Grimes', $button_template]);
     $answers = $bot->getAnswers('text', 'button');
     $button = $answers[1];
     $this->assertArrayHasKey('attachment', $button);
     $this->assertArrayHasKey('payload', $button['attachment']);
     $this->assertArrayHasKey('type', $button['attachment']);
     $mixed = $this->generateStandardButton($button_template);
     $this->assertEquals($mixed, $button);
     $rick_grimes = $answers[0];
     $this->assertEquals(['text' => 'Rick Grimes'], $rick_grimes);
 }