From c1719bf84a14bd719407567c62c836c75edc0793 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Mon, 25 Apr 2022 11:30:43 +0300 Subject: [PATCH] `addTags` and `removeTags` fields --- src/Model/Entity/Customers/Customer.php | 16 +++++++++++++ tests/src/ResourceGroup/CustomersTest.php | 29 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/Model/Entity/Customers/Customer.php b/src/Model/Entity/Customers/Customer.php index 8d233fc..4af67de 100644 --- a/src/Model/Entity/Customers/Customer.php +++ b/src/Model/Entity/Customers/Customer.php @@ -120,6 +120,22 @@ class Customer implements CustomerInterface */ public $tags; + /** + * @var string[] + * + * @JMS\Type("array") + * @JMS\SerializedName("addTags") + */ + public $addTags; + + /** + * @var string[] + * + * @JMS\Type("array") + * @JMS\SerializedName("removeTags") + */ + public $removeTags; + /** * @var float * diff --git a/tests/src/ResourceGroup/CustomersTest.php b/tests/src/ResourceGroup/CustomersTest.php index e35686f..7e54400 100644 --- a/tests/src/ResourceGroup/CustomersTest.php +++ b/tests/src/ResourceGroup/CustomersTest.php @@ -2698,4 +2698,33 @@ EOF; self::assertModelEqualsToResponse($json, $response); } + + public function testCustomersEditTags(): void + { + $json = <<<'EOF' +{ + "success": true, + "id": 4770 +} +EOF; + + $request = new CustomersEditRequest(); + $request->customer = new Customer(); + $request->by = ByIdentifier::ID; + $request->site = 'aliexpress'; + $request->customer->firstName = 'Test'; + $request->customer->addTags = ['tag1', 'tag2']; + $request->customer->removeTags = ['tag3', 'tag4']; + + $mock = static::createApiMockBuilder('customers/4770/edit'); + $mock->matchMethod(RequestMethod::POST) + ->matchBody(static::encodeForm($request)) + ->reply(200) + ->withBody($json); + + $client = TestClientFactory::createClient($mock->getClient()); + $response = $client->customers->edit(4770, $request); + + self::assertModelEqualsToResponse($json, $response); + } }