Repository: defstudio/telegraph (php)

Issue:
Implement `deleteChatPhoto` method
ref https://core.telegram.org/bots/api#deletechatphoto

Pull request description:
Implement `deleteChatPhoto` method
Implements method for deleting chat photo.

Closes #191

Patch:
diff --git a/src/Concerns/HasBotsAndChats.php b/src/Concerns/HasBotsAndChats.php
index 4e74b327..295a3ba1 100644
--- a/src/Concerns/HasBotsAndChats.php
+++ b/src/Concerns/HasBotsAndChats.php
@@ -242,6 +242,16 @@ trait HasBotsAndChats
         return $telegraph;
     }
 
+    public function deleteChatPhoto(): Telegraph
+    {
+        $telegraph = clone $this;
+
+        $telegraph->endpoint = self::ENDPOINT_DELETE_CHAT_PHOTO;
+        $telegraph->data['chat_id'] = $telegraph->getChat()->chat_id;
+
+        return $telegraph;
+    }
+
     public function chatInfo(): Telegraph
     {
         $telegraph = clone $this;
diff --git a/src/Models/TelegraphChat.php b/src/Models/TelegraphChat.php
index 145240e0..47556592 100644
--- a/src/Models/TelegraphChat.php
+++ b/src/Models/TelegraphChat.php
@@ -196,6 +196,11 @@ class TelegraphChat extends Model
         return TelegraphFacade::chat($this)->setChatPhoto($path);
     }
 
+    public function deleteChatPhoto(): Telegraph
+    {
+        return TelegraphFacade::chat($this)->deleteChatPhoto();
+    }
+
     public function generatePrimaryInviteLink(): Telegraph
     {
         return TelegraphFacade::chat($this)->generateChatPrimaryInviteLink();
diff --git a/src/Telegraph.php b/src/Telegraph.php
index 6e3de199..78ea7b2d 100755
--- a/src/Telegraph.php
+++ b/src/Telegraph.php
@@ -75,6 +75,7 @@ class Telegraph
     public const ENDPOINT_SET_CHAT_TITLE = 'setChatTitle';
     public const ENDPOINT_SET_CHAT_DESCRIPTION = 'setChatDescription';
     public const ENDPOINT_SET_CHAT_PHOTO = 'setChatPhoto';
+    public const ENDPOINT_DELETE_CHAT_PHOTO = 'deleteChatPhoto';
     public const ENDPOINT_EXPORT_CHAT_INVITE_LINK = 'exportChatInviteLink';
     public const ENDPOINT_CREATE_CHAT_INVITE_LINK = 'createChatInviteLink';
     public const ENDPOINT_EDIT_CHAT_INVITE_LINK = 'editChatInviteLink';


Test patch:
diff --git a/tests/Unit/Concerns/HasBotsAndChatsTest.php b/tests/Unit/Concerns/HasBotsAndChatsTest.php
index cd2b0837..80d7e4f2 100644
--- a/tests/Unit/Concerns/HasBotsAndChatsTest.php
+++ b/tests/Unit/Concerns/HasBotsAndChatsTest.php
@@ -130,6 +130,12 @@ test('photo is validated', function (string $path, bool $valid, string $exceptio
     ],
 ]);
 
+it('can delete chat photo', function () {
+    expect(function (\DefStudio\Telegraph\Telegraph $telegraph) {
+        return $telegraph->chat(make_chat())->deleteChatPhoto();
+    })->toMatchTelegramSnapshot();
+});
+
 it('can retrieve chat info', function () {
     expect(function (\DefStudio\Telegraph\Telegraph $telegraph) {
         return $telegraph->chat(make_chat())->chatInfo();
diff --git a/tests/Unit/Models/TelegraphChatTest.php b/tests/Unit/Models/TelegraphChatTest.php
index b653cc58..0c75f842 100644
--- a/tests/Unit/Models/TelegraphChatTest.php
+++ b/tests/Unit/Models/TelegraphChatTest.php
@@ -252,6 +252,15 @@ it('can unpin all messages', function () {
     Telegraph::assertSentData(\DefStudio\Telegraph\Telegraph::ENDPOINT_UNPIN_ALL_MESSAGES);
 });
 
+it('can delete a chat photo', function () {
+    Telegraph::fake();
+    $chat = make_chat();
+
+    $chat->deleteChatPhoto()->send();
+
+    Telegraph::assertSentData(\DefStudio\Telegraph\Telegraph::ENDPOINT_DELETE_CHAT_PHOTO);
+});
+
 it('can leave a chat', function () {
     Telegraph::fake();
     $chat = make_chat();
diff --git a/tests/__snapshots__/HasBotsAndChatsTest__it_can_delete_chat_photo__1.yml b/tests/__snapshots__/HasBotsAndChatsTest__it_can_delete_chat_photo__1.yml
new file mode 100644
index 00000000..7d22f330
--- /dev/null
+++ b/tests/__snapshots__/HasBotsAndChatsTest__it_can_delete_chat_photo__1.yml
@@ -0,0 +1,4 @@
+url: 'https://api.telegram.org/bot3f3814e1-5836-3d77-904e-60f64b15df36/deleteChatPhoto'
+payload:
+    chat_id: '-123456789'
+files: {  }