From 6394ea6a5086eb83ad5ccdd771f6e0a1efdc88a9 Mon Sep 17 00:00:00 2001 From: Piotr Bednarz Date: Mon, 13 Apr 2026 14:55:50 +0200 Subject: [PATCH] Change PUT to PATCH method for contacts#update action --- src/Api/General/Contact.php | 2 +- tests/Api/General/ContactTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Api/General/Contact.php b/src/Api/General/Contact.php index b6323c3..4a5b0ca 100644 --- a/src/Api/General/Contact.php +++ b/src/Api/General/Contact.php @@ -381,7 +381,7 @@ private function getContact(string $idOrEmail): ResponseInterface private function updateContact(string $contactIdOrEmail, UpdateContact $contact): ResponseInterface { return $this->handleResponse( - $this->httpPut( + $this->httpPatch( path: $this->getBasePath() . '/' . urlencode($contactIdOrEmail), body: ['contact' => $contact->toArray()] ) diff --git a/tests/Api/General/ContactTest.php b/tests/Api/General/ContactTest.php index 6d82a08..70f00fe 100644 --- a/tests/Api/General/ContactTest.php +++ b/tests/Api/General/ContactTest.php @@ -32,7 +32,7 @@ protected function setUp(): void parent::setUp(); $this->contact = $this->getMockBuilder(Contact::class) - ->onlyMethods(['httpGet', 'httpPost', 'httpPut', 'httpPatch', 'httpDelete']) + ->onlyMethods(['httpGet', 'httpPost', 'httpPatch', 'httpDelete']) ->setConstructorArgs([$this->getConfigMock(), self::FAKE_ACCOUNT_ID]) ->getMock(); } @@ -236,7 +236,7 @@ public function testUpdateContactById(): void $contactDTO = new UpdateContact('test@example.com', ['last_name' => 'Smith'], [3], [1, 2], true); $this->contact->expects($this->once()) - ->method('httpPut') + ->method('httpPatch') ->with( AbstractApi::DEFAULT_HOST . '/api/accounts/' . self::FAKE_ACCOUNT_ID . '/contacts/' . $contactId, [], @@ -266,7 +266,7 @@ public function testUpdateContactByEmail(): void $contactDTO = new UpdateContact('test@example.com', ['last_name' => 'Smith'], [3], [1, 2], true); $this->contact->expects($this->once()) - ->method('httpPut') + ->method('httpPatch') ->with( AbstractApi::DEFAULT_HOST . '/api/accounts/' . self::FAKE_ACCOUNT_ID . '/contacts/' . urlencode($contactEmail), [], @@ -289,7 +289,7 @@ public function testUpdateContactExcludesNullUnsubscribed(): void $contactDTO = new UpdateContact($contactEmail, ['last_name' => 'Smith'], [3], [1, 2]); $this->contact->expects($this->once()) - ->method('httpPut') + ->method('httpPatch') ->with( AbstractApi::DEFAULT_HOST . '/api/accounts/' . self::FAKE_ACCOUNT_ID . '/contacts/' . urlencode($contactEmail), [],