From 3403d1e559b9a71d39a45557ca9e32f6a216da4f Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 28 Jan 2021 10:45:21 +0300 Subject: [PATCH] Add new test method I created new method which test contact message --- src/Testing/BotManTester.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Testing/BotManTester.php b/src/Testing/BotManTester.php index 7c685da..2b3aa54 100644 --- a/src/Testing/BotManTester.php +++ b/src/Testing/BotManTester.php @@ -5,6 +5,7 @@ use BotMan\BotMan\BotMan; use BotMan\BotMan\Drivers\Tests\FakeDriver; use BotMan\BotMan\Messages\Attachments\Audio; +use BotMan\BotMan\Messages\Attachments\Contact; use BotMan\BotMan\Messages\Attachments\File; use BotMan\BotMan\Messages\Attachments\Image; use BotMan\BotMan\Messages\Attachments\Location; @@ -142,7 +143,28 @@ public function receivesLocation($latitude = 24, $longitude = 57) return $this->receivesRaw($message); } + + /** + * @param string $phone + * @param string $first_name + * @param string $last_name + * @param string $vcard + * @return $this + */ + public function receivesContact($phone = '', $first_name = '', $last_name = '', $vcard = '') + { + $message = new IncomingMessage(Contact::PATTERN, $this->user_id, $this->channel); + $message->setContact(new Contact( + $phone, + $first_name, + $last_name, + $this->user_id, + $vcard + )); + return $this->receivesRaw($message); + } + /** * @param array $urls * @return $this