diff --git a/src/TelegramAudioDriver.php b/src/TelegramAudioDriver.php index d72898c..5100b12 100644 --- a/src/TelegramAudioDriver.php +++ b/src/TelegramAudioDriver.php @@ -20,6 +20,14 @@ public function matchesRequest() return ! is_null($this->event->get('from')) && (! is_null($this->event->get('audio')) || ! is_null($this->event->get('voice'))); } + /** + * @return bool + */ + public function hasMatchingEvent() + { + return false; + } + /** * Retrieve the chat message. * diff --git a/src/TelegramFileDriver.php b/src/TelegramFileDriver.php index c65ef4c..1e691fa 100644 --- a/src/TelegramFileDriver.php +++ b/src/TelegramFileDriver.php @@ -20,6 +20,14 @@ public function matchesRequest() return ! is_null($this->event->get('from')) && (! is_null($this->event->get('document'))); } + /** + * @return bool + */ + public function hasMatchingEvent() + { + return false; + } + /** * Retrieve the chat message. * diff --git a/src/TelegramLocationDriver.php b/src/TelegramLocationDriver.php index 7b8267a..1a28b36 100644 --- a/src/TelegramLocationDriver.php +++ b/src/TelegramLocationDriver.php @@ -19,6 +19,14 @@ public function matchesRequest() return ! is_null($this->event->get('from')) && ! is_null($this->event->get('location')); } + /** + * @return bool + */ + public function hasMatchingEvent() + { + return false; + } + /** * Retrieve the chat message. * diff --git a/src/TelegramPhotoDriver.php b/src/TelegramPhotoDriver.php index 57b389e..52b6560 100644 --- a/src/TelegramPhotoDriver.php +++ b/src/TelegramPhotoDriver.php @@ -21,6 +21,14 @@ public function matchesRequest() return ! is_null($this->event->get('from')) && ! is_null($this->event->get('photo')); } + /** + * @return bool + */ + public function hasMatchingEvent() + { + return false; + } + /** * Retrieve the chat message. * diff --git a/src/TelegramVideoDriver.php b/src/TelegramVideoDriver.php index a770c44..836c040 100644 --- a/src/TelegramVideoDriver.php +++ b/src/TelegramVideoDriver.php @@ -20,6 +20,14 @@ public function matchesRequest() return ! is_null($this->event->get('from')) && ! is_null($this->event->get('video')); } + /** + * @return bool + */ + public function hasMatchingEvent() + { + return false; + } + /** * Retrieve the chat message. * diff --git a/tests/TelegramAudioDriverTest.php b/tests/TelegramAudioDriverTest.php index f1c8a4d..05348e1 100644 --- a/tests/TelegramAudioDriverTest.php +++ b/tests/TelegramAudioDriverTest.php @@ -240,4 +240,31 @@ public function it_throws_exception_in_get_attachment_url() $this->assertSame(TelegramAttachmentException::class, get_class($t)); } } + + /** @test */ + public function it_havent_to_match_any_event() + { + $driver = $this->getDriver([ + 'update_id' => '1234567890', + 'message' => [ + 'message_id' => '123', + 'from' => [ + 'id' => 'from_id', + ], + 'chat' => [ + 'id' => 'chat_id', + ], + 'date' => '1480369277', + 'text' => 'Hi Julia', + 'new_chat_member' => [ + 'id' => '456', + 'first_name' => 'Marcel', + 'last_name' => 'Pociot', + 'username' => 'mpociot', + ], + ], + ]); + $this->assertFalse($driver->matchesRequest()); + $this->assertFalse($driver->hasMatchingEvent()); + } } diff --git a/tests/TelegramFileDriverTest.php b/tests/TelegramFileDriverTest.php index d4eafbf..72eb4d5 100644 --- a/tests/TelegramFileDriverTest.php +++ b/tests/TelegramFileDriverTest.php @@ -169,4 +169,31 @@ public function it_throws_exception_in_get_attachment_url() $this->assertSame(TelegramAttachmentException::class, get_class($t)); } } + + /** @test */ + public function it_havent_to_match_any_event() + { + $driver = $this->getDriver([ + 'update_id' => '1234567890', + 'message' => [ + 'message_id' => '123', + 'from' => [ + 'id' => 'from_id', + ], + 'chat' => [ + 'id' => 'chat_id', + ], + 'date' => '1480369277', + 'text' => 'Hi Julia', + 'new_chat_member' => [ + 'id' => '456', + 'first_name' => 'Marcel', + 'last_name' => 'Pociot', + 'username' => 'mpociot', + ], + ], + ]); + $this->assertFalse($driver->matchesRequest()); + $this->assertFalse($driver->hasMatchingEvent()); + } } diff --git a/tests/TelegramLocationDriverTest.php b/tests/TelegramLocationDriverTest.php index a5034ad..270c240 100644 --- a/tests/TelegramLocationDriverTest.php +++ b/tests/TelegramLocationDriverTest.php @@ -105,4 +105,31 @@ public function it_returns_the_location() 'longitude' => -122.123854248, ], $location->getPayload()); } + + /** @test */ + public function it_havent_to_match_any_event() + { + $driver = $this->getDriver([ + 'update_id' => '1234567890', + 'message' => [ + 'message_id' => '123', + 'from' => [ + 'id' => 'from_id', + ], + 'chat' => [ + 'id' => 'chat_id', + ], + 'date' => '1480369277', + 'text' => 'Hi Julia', + 'new_chat_member' => [ + 'id' => '456', + 'first_name' => 'Marcel', + 'last_name' => 'Pociot', + 'username' => 'mpociot', + ], + ], + ]); + $this->assertFalse($driver->matchesRequest()); + $this->assertFalse($driver->hasMatchingEvent()); + } } diff --git a/tests/TelegramPhotoDriverTest.php b/tests/TelegramPhotoDriverTest.php index 272657b..734d642 100644 --- a/tests/TelegramPhotoDriverTest.php +++ b/tests/TelegramPhotoDriverTest.php @@ -177,4 +177,31 @@ public function it_throws_exception_in_get_attachment_url() $this->assertSame(TelegramAttachmentException::class, get_class($t)); } } + + /** @test */ + public function it_havent_to_match_any_event() + { + $driver = $this->getDriver([ + 'update_id' => '1234567890', + 'message' => [ + 'message_id' => '123', + 'from' => [ + 'id' => 'from_id', + ], + 'chat' => [ + 'id' => 'chat_id', + ], + 'date' => '1480369277', + 'text' => 'Hi Julia', + 'new_chat_member' => [ + 'id' => '456', + 'first_name' => 'Marcel', + 'last_name' => 'Pociot', + 'username' => 'mpociot', + ], + ], + ]); + $this->assertFalse($driver->matchesRequest()); + $this->assertFalse($driver->hasMatchingEvent()); + } } diff --git a/tests/TelegramVideoDriverTest.php b/tests/TelegramVideoDriverTest.php index 3225dfa..2fbc29a 100644 --- a/tests/TelegramVideoDriverTest.php +++ b/tests/TelegramVideoDriverTest.php @@ -188,4 +188,31 @@ public function it_throws_exception_in_get_attachment_url() $this->assertSame(TelegramAttachmentException::class, get_class($t)); } } + + /** @test */ + public function it_havent_to_match_any_event() + { + $driver = $this->getDriver([ + 'update_id' => '1234567890', + 'message' => [ + 'message_id' => '123', + 'from' => [ + 'id' => 'from_id', + ], + 'chat' => [ + 'id' => 'chat_id', + ], + 'date' => '1480369277', + 'text' => 'Hi Julia', + 'new_chat_member' => [ + 'id' => '456', + 'first_name' => 'Marcel', + 'last_name' => 'Pociot', + 'username' => 'mpociot', + ], + ], + ]); + $this->assertFalse($driver->matchesRequest()); + $this->assertFalse($driver->hasMatchingEvent()); + } }