From 572ec07f7e35aa9fa91e28740cacd933623f686b Mon Sep 17 00:00:00 2001 From: Patryk Gruszka Date: Tue, 5 Mar 2024 10:10:44 +0100 Subject: [PATCH 1/6] feat: [DPMMA-2550] point groups api --- lib/Api/PointGroups.php | 41 +++++++++++++++++++++++++ tests/Api/PointGroupsTest.php | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 lib/Api/PointGroups.php create mode 100644 tests/Api/PointGroupsTest.php diff --git a/lib/Api/PointGroups.php b/lib/Api/PointGroups.php new file mode 100644 index 0000000..72195f0 --- /dev/null +++ b/lib/Api/PointGroups.php @@ -0,0 +1,41 @@ +api = $this->getContext('pointGroups'); + $this->testPayload = [ + 'name' => 'New Point Group', + 'description' => 'Description of the new point group', + ]; + } + + public function testGetList() + { + $this->standardTestGetList(); + } + + public function testGetListOfSpecificIds() + { + $this->standardTestGetListOfSpecificIds(); + } + + public function testCreateGetAndDelete() + { + $this->standardTestCreateGetAndDelete(); + } + + public function testEditPatch() + { + $editTo = [ + 'name' => 'Updated Point Group Name', + ]; + $this->standardTestEditPatch($editTo); + } + + public function testEditPut() + { + $this->standardTestEditPut(); + } + + public function testBatchEndpoints() + { + $this->standardTestBatchEndpoints(); + } +} From dfce6409017cc2c88363733d91c175c0c757c3a4 Mon Sep 17 00:00:00 2001 From: Patryk Gruszka Date: Tue, 5 Mar 2024 10:44:18 +0100 Subject: [PATCH 2/6] feat: [DPMMA-2550] contact point groups score api --- lib/Api/Contacts.php | 101 +++++++++++++++++++++++++++++++++++++ tests/Api/ContactsTest.php | 101 +++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+) diff --git a/lib/Api/Contacts.php b/lib/Api/Contacts.php index 14265ea..12a1ecc 100644 --- a/lib/Api/Contacts.php +++ b/lib/Api/Contacts.php @@ -337,6 +337,107 @@ public function subtractPoints($id, $points, array $parameters = []) return $this->makeRequest('contacts/'.$id.'/points/minus/'.$points, $parameters, 'POST'); } + /** + * Get all point group scores associated with contact. + * + * @param int $contactId + * @param int $groupId + * + * @return array|mixed + */ + public function getPointGroupScores(int $contactId) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups'); + } + + /** + * Get the contact score for a specified point group. + * + * @param int $contactId + * @param int $groupId + * + * @return array|mixed + */ + public function getPointGroupScore(int $contactId, int $groupId) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId); + } + + /** + * Increase the score of the contact point group. + * + * @param int $contactId + * @param int $groupId + * @param int $points + * @param array $parameters 'eventName' and 'actionName' + * + * @return mixed + */ + public function addPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/plus/'.$points, $parameters, 'POST'); + } + + /** + * Decrease the score of the contact point group. + * + * @param int $contactId + * @param int $groupId + * @param int $points + * @param array $parameters 'eventName' and 'actionName' + * + * @return mixed + */ + public function subtractPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/minus/'.$points, $parameters, 'POST'); + } + + /** + * Multiply the score of the contact point group. + * + * @param int $contactId + * @param int $groupId + * @param int $value + * @param array $parameters 'eventName' and 'actionName' + * + * @return mixed + */ + public function multiplyPointGroupScore(int $contactId, int $groupId, int $value, array $parameters = []) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/times/'.$value, $parameters, 'POST'); + } + + /** + * Divide the score of the contact point group. + * + * @param int $contactId + * @param int $groupId + * @param int $value + * @param array $parameters 'eventName' and 'actionName' + * + * @return mixed + */ + public function dividePointGroupScore(int $contactId, int $groupId, int $value, array $parameters = []) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/divide/'.$value, $parameters, 'POST'); + } + + /** + * Set the score of the contact point group. + * + * @param int $contactId + * @param int $groupId + * @param int $points + * @param array $parameters 'eventName' and 'actionName' + * + * @return mixed + */ + public function setPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []) + { + return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/set/'.$points, $parameters, 'POST'); + } + /** * Adds Do Not Contact. * diff --git a/tests/Api/ContactsTest.php b/tests/Api/ContactsTest.php index 91a505c..38792a4 100644 --- a/tests/Api/ContactsTest.php +++ b/tests/Api/ContactsTest.php @@ -419,6 +419,107 @@ public function testSubtractPoints() $this->assertErrors($response); } + public function testAddPointGroupScore() + { + $pointsToAdd = 5; + $pointGroupApi = $this->getContext('pointGroups'); + $response = $pointGroupApi->create(['name' => 'Group A']); + $pointGroup = $response[$pointGroupApi->itemName()]; + + $response = $this->api->create($this->testPayload); + $this->assertErrors($response); + $contact = $response[$this->api->itemName()]; + + $response = $this->api->addPointGroupScore($contact['id'], $pointGroup['id'], $pointsToAdd); + $this->assertErrors($response); + $this->assertTrue(!empty($response['groupScore']), 'Adding point group score to a contact with ID ='.$contact['id'].' was not successful'); + + $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); + $this->assertErrors($response); + $this->assertSame($response['groupScore']['score'], $pointsToAdd, 'Point group score was not added accurately'); + + $response = $this->api->delete($contact['id']); + $this->assertErrors($response); + } + + public function testSubtractPointGroupScore() + { + $pointsToSubtract = 3; + $pointGroupApi = $this->getContext('pointGroups'); + $response = $pointGroupApi->create(['name' => 'Group B']); + $pointGroup = $response[$pointGroupApi->itemName()]; + + $response = $this->api->create($this->testPayload); + $this->assertErrors($response); + $contact = $response[$this->api->itemName()]; + + $response = $this->api->setPointGroupScore($contact['id'], $pointGroup['id'], 10); + $this->assertErrors($response); + + $response = $this->api->subtractPointGroupScore($contact['id'], $pointGroup['id'], $pointsToSubtract); + $this->assertErrors($response); + $this->assertTrue(!empty($response['groupScore']), 'Subtracting point group score from a contact with ID =' . $contact['id'] . ' was not successful'); + + $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); + $this->assertErrors($response); + $this->assertSame($response['groupScore']['score'], 10 - $pointsToSubtract, 'Point group score was not subtracted accurately'); + + $response = $this->api->delete($contact['id']); + $this->assertErrors($response); + } + + public function testMultiplyPointGroupScore() + { + $multiplier = 2; + $pointGroupApi = $this->getContext('pointGroups'); + $response = $pointGroupApi->create(['name' => 'Group C']); + $pointGroup = $response[$pointGroupApi->itemName()]; + + $response = $this->api->create($this->testPayload); + $this->assertErrors($response); + $contact = $response[$this->api->itemName()]; + + $response = $this->api->setPointGroupScore($contact['id'], $pointGroup['id'], 5); + $this->assertErrors($response); + + $response = $this->api->multiplyPointGroupScore($contact['id'], $pointGroup['id'], $multiplier); + $this->assertErrors($response); + $this->assertTrue(!empty($response['groupScore']), 'Multiplying point group score for a contact with ID =' . $contact['id'] . ' was not successful'); + + $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); + $this->assertErrors($response); + $this->assertSame($response['groupScore']['score'], 5 * $multiplier, 'Point group score was not multiplied accurately'); + + $response = $this->api->delete($contact['id']); + $this->assertErrors($response); + } + + public function testDividePointGroupScore() + { + $divisor = 4; + $pointGroupApi = $this->getContext('pointGroups'); + $response = $pointGroupApi->create(['name' => 'Group D']); + $pointGroup = $response[$pointGroupApi->itemName()]; + + $response = $this->api->create($this->testPayload); + $this->assertErrors($response); + $contact = $response[$this->api->itemName()]; + + $response = $this->api->setPointGroupScore($contact['id'], $pointGroup['id'], 20); + $this->assertErrors($response); + + $response = $this->api->dividePointGroupScore($contact['id'], $pointGroup['id'], $divisor); + $this->assertErrors($response); + $this->assertTrue(!empty($response['groupScore']), 'Dividing point group score for a contact with ID =' . $contact['id'] . ' was not successful'); + + $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); + $this->assertErrors($response); + $this->assertSame($response['groupScore']['score'], 20 / $divisor, 'Point group score was not divided accurately'); + + $response = $this->api->delete($contact['id']); + $this->assertErrors($response); + } + public function testBatchEndpoints() { $contact1 = $this->testPayload; From 5460af8b7574245c7612260a003fb6d16fd8b1de Mon Sep 17 00:00:00 2001 From: Patryk Gruszka Date: Tue, 5 Mar 2024 11:04:12 +0100 Subject: [PATCH 3/6] fix: [DPMMA-2550] csfixer for contact point group score --- lib/Api/Contacts.php | 21 +-------------------- tests/Api/ContactsTest.php | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/lib/Api/Contacts.php b/lib/Api/Contacts.php index 12a1ecc..27afa33 100644 --- a/lib/Api/Contacts.php +++ b/lib/Api/Contacts.php @@ -340,8 +340,7 @@ public function subtractPoints($id, $points, array $parameters = []) /** * Get all point group scores associated with contact. * - * @param int $contactId - * @param int $groupId + * @param int $groupId * * @return array|mixed */ @@ -353,9 +352,6 @@ public function getPointGroupScores(int $contactId) /** * Get the contact score for a specified point group. * - * @param int $contactId - * @param int $groupId - * * @return array|mixed */ public function getPointGroupScore(int $contactId, int $groupId) @@ -366,9 +362,6 @@ public function getPointGroupScore(int $contactId, int $groupId) /** * Increase the score of the contact point group. * - * @param int $contactId - * @param int $groupId - * @param int $points * @param array $parameters 'eventName' and 'actionName' * * @return mixed @@ -381,9 +374,6 @@ public function addPointGroupScore(int $contactId, int $groupId, int $points, ar /** * Decrease the score of the contact point group. * - * @param int $contactId - * @param int $groupId - * @param int $points * @param array $parameters 'eventName' and 'actionName' * * @return mixed @@ -396,9 +386,6 @@ public function subtractPointGroupScore(int $contactId, int $groupId, int $point /** * Multiply the score of the contact point group. * - * @param int $contactId - * @param int $groupId - * @param int $value * @param array $parameters 'eventName' and 'actionName' * * @return mixed @@ -411,9 +398,6 @@ public function multiplyPointGroupScore(int $contactId, int $groupId, int $value /** * Divide the score of the contact point group. * - * @param int $contactId - * @param int $groupId - * @param int $value * @param array $parameters 'eventName' and 'actionName' * * @return mixed @@ -426,9 +410,6 @@ public function dividePointGroupScore(int $contactId, int $groupId, int $value, /** * Set the score of the contact point group. * - * @param int $contactId - * @param int $groupId - * @param int $points * @param array $parameters 'eventName' and 'actionName' * * @return mixed diff --git a/tests/Api/ContactsTest.php b/tests/Api/ContactsTest.php index 38792a4..c7c1bda 100644 --- a/tests/Api/ContactsTest.php +++ b/tests/Api/ContactsTest.php @@ -421,10 +421,10 @@ public function testSubtractPoints() public function testAddPointGroupScore() { - $pointsToAdd = 5; + $pointsToAdd = 5; $pointGroupApi = $this->getContext('pointGroups'); - $response = $pointGroupApi->create(['name' => 'Group A']); - $pointGroup = $response[$pointGroupApi->itemName()]; + $response = $pointGroupApi->create(['name' => 'Group A']); + $pointGroup = $response[$pointGroupApi->itemName()]; $response = $this->api->create($this->testPayload); $this->assertErrors($response); @@ -445,9 +445,9 @@ public function testAddPointGroupScore() public function testSubtractPointGroupScore() { $pointsToSubtract = 3; - $pointGroupApi = $this->getContext('pointGroups'); - $response = $pointGroupApi->create(['name' => 'Group B']); - $pointGroup = $response[$pointGroupApi->itemName()]; + $pointGroupApi = $this->getContext('pointGroups'); + $response = $pointGroupApi->create(['name' => 'Group B']); + $pointGroup = $response[$pointGroupApi->itemName()]; $response = $this->api->create($this->testPayload); $this->assertErrors($response); @@ -458,7 +458,7 @@ public function testSubtractPointGroupScore() $response = $this->api->subtractPointGroupScore($contact['id'], $pointGroup['id'], $pointsToSubtract); $this->assertErrors($response); - $this->assertTrue(!empty($response['groupScore']), 'Subtracting point group score from a contact with ID =' . $contact['id'] . ' was not successful'); + $this->assertTrue(!empty($response['groupScore']), 'Subtracting point group score from a contact with ID ='.$contact['id'].' was not successful'); $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); $this->assertErrors($response); @@ -470,10 +470,10 @@ public function testSubtractPointGroupScore() public function testMultiplyPointGroupScore() { - $multiplier = 2; + $multiplier = 2; $pointGroupApi = $this->getContext('pointGroups'); - $response = $pointGroupApi->create(['name' => 'Group C']); - $pointGroup = $response[$pointGroupApi->itemName()]; + $response = $pointGroupApi->create(['name' => 'Group C']); + $pointGroup = $response[$pointGroupApi->itemName()]; $response = $this->api->create($this->testPayload); $this->assertErrors($response); @@ -484,7 +484,7 @@ public function testMultiplyPointGroupScore() $response = $this->api->multiplyPointGroupScore($contact['id'], $pointGroup['id'], $multiplier); $this->assertErrors($response); - $this->assertTrue(!empty($response['groupScore']), 'Multiplying point group score for a contact with ID =' . $contact['id'] . ' was not successful'); + $this->assertTrue(!empty($response['groupScore']), 'Multiplying point group score for a contact with ID ='.$contact['id'].' was not successful'); $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); $this->assertErrors($response); @@ -496,10 +496,10 @@ public function testMultiplyPointGroupScore() public function testDividePointGroupScore() { - $divisor = 4; + $divisor = 4; $pointGroupApi = $this->getContext('pointGroups'); - $response = $pointGroupApi->create(['name' => 'Group D']); - $pointGroup = $response[$pointGroupApi->itemName()]; + $response = $pointGroupApi->create(['name' => 'Group D']); + $pointGroup = $response[$pointGroupApi->itemName()]; $response = $this->api->create($this->testPayload); $this->assertErrors($response); @@ -510,7 +510,7 @@ public function testDividePointGroupScore() $response = $this->api->dividePointGroupScore($contact['id'], $pointGroup['id'], $divisor); $this->assertErrors($response); - $this->assertTrue(!empty($response['groupScore']), 'Dividing point group score for a contact with ID =' . $contact['id'] . ' was not successful'); + $this->assertTrue(!empty($response['groupScore']), 'Dividing point group score for a contact with ID ='.$contact['id'].' was not successful'); $response = $this->api->getPointGroupScore($contact['id'], $pointGroup['id']); $this->assertErrors($response); From 574d1cbafbeb596bb4e6757d68225e6375dff260 Mon Sep 17 00:00:00 2001 From: Patryk Gruszka Date: Mon, 29 Apr 2024 14:13:24 +0200 Subject: [PATCH 4/6] fix: [DPMMA-2550] extra test and type definitions --- lib/Api/Contacts.php | 30 ++++++----------------- tests/Api/ContactsTest.php | 45 +++++++++++++++++++++++++++++++---- tests/Api/PointGroupsTest.php | 22 +++++++---------- 3 files changed, 56 insertions(+), 41 deletions(-) diff --git a/lib/Api/Contacts.php b/lib/Api/Contacts.php index 27afa33..e222255 100644 --- a/lib/Api/Contacts.php +++ b/lib/Api/Contacts.php @@ -339,22 +339,16 @@ public function subtractPoints($id, $points, array $parameters = []) /** * Get all point group scores associated with contact. - * - * @param int $groupId - * - * @return array|mixed */ - public function getPointGroupScores(int $contactId) + public function getPointGroupScores(int $contactId): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups'); } /** * Get the contact score for a specified point group. - * - * @return array|mixed */ - public function getPointGroupScore(int $contactId, int $groupId) + public function getPointGroupScore(int $contactId, int $groupId): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId); } @@ -363,10 +357,8 @@ public function getPointGroupScore(int $contactId, int $groupId) * Increase the score of the contact point group. * * @param array $parameters 'eventName' and 'actionName' - * - * @return mixed */ - public function addPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []) + public function addPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/plus/'.$points, $parameters, 'POST'); } @@ -375,10 +367,8 @@ public function addPointGroupScore(int $contactId, int $groupId, int $points, ar * Decrease the score of the contact point group. * * @param array $parameters 'eventName' and 'actionName' - * - * @return mixed */ - public function subtractPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []) + public function subtractPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/minus/'.$points, $parameters, 'POST'); } @@ -387,10 +377,8 @@ public function subtractPointGroupScore(int $contactId, int $groupId, int $point * Multiply the score of the contact point group. * * @param array $parameters 'eventName' and 'actionName' - * - * @return mixed */ - public function multiplyPointGroupScore(int $contactId, int $groupId, int $value, array $parameters = []) + public function multiplyPointGroupScore(int $contactId, int $groupId, int $value, array $parameters = []): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/times/'.$value, $parameters, 'POST'); } @@ -399,10 +387,8 @@ public function multiplyPointGroupScore(int $contactId, int $groupId, int $value * Divide the score of the contact point group. * * @param array $parameters 'eventName' and 'actionName' - * - * @return mixed */ - public function dividePointGroupScore(int $contactId, int $groupId, int $value, array $parameters = []) + public function dividePointGroupScore(int $contactId, int $groupId, int $value, array $parameters = []): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/divide/'.$value, $parameters, 'POST'); } @@ -411,10 +397,8 @@ public function dividePointGroupScore(int $contactId, int $groupId, int $value, * Set the score of the contact point group. * * @param array $parameters 'eventName' and 'actionName' - * - * @return mixed */ - public function setPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []) + public function setPointGroupScore(int $contactId, int $groupId, int $points, array $parameters = []): array { return $this->makeRequest('contacts/'.$contactId.'/points/groups/'.$groupId.'/set/'.$points, $parameters, 'POST'); } diff --git a/tests/Api/ContactsTest.php b/tests/Api/ContactsTest.php index c7c1bda..f4d03d1 100644 --- a/tests/Api/ContactsTest.php +++ b/tests/Api/ContactsTest.php @@ -419,7 +419,44 @@ public function testSubtractPoints() $this->assertErrors($response); } - public function testAddPointGroupScore() + public function testGetPointGroupScores(): void + { + $response = $this->api->create($this->testPayload); + $this->assertErrors($response); + $contact = $response[$this->api->itemName()]; + + // test empty group points list + $response = $this->api->getPointGroupScores($contact['id']); + $this->assertErrors($response); + $this->assertSame(0, $response['total']); + $this->assertIsArray($response['groupScores']); + $this->assertEmpty(0, $response['groupScores']); + + // add score + $pointsToAdd = 5; + $pointGroupApi = $this->getContext('pointGroups'); + $response = $pointGroupApi->create(['name' => 'Group A']); + $pointGroup = $response[$pointGroupApi->itemName()]; + $response = $this->api->addPointGroupScore($contact['id'], $pointGroup['id'], $pointsToAdd); + $this->assertErrors($response); + $this->assertNotEmpty($response['groupScore'], 'Adding point group score to a contact with ID =' . $contact['id'] . ' was not successful'); + + // test get point group scores list + $response = $this->api->getPointGroupScores($contact['id']); + $this->assertErrors($response); + $this->assertSame(1, $response['total']); + $this->assertIsArray($response['groupScores']); + $this->assertCount(1, $response['groupScores']); + $this->assertSame(5, $response['groupScores'][0]['score']); + $this->assertSame($pointGroup['id'], $response['groupScores'][0]['group']['id']); + $this->assertSame($pointGroup['name'], $response['groupScores'][0]['group']['name']); + $this->assertSame($pointGroup['description'], $response['groupScores'][0]['group']['description']); + + $response = $this->api->delete($contact['id']); + $this->assertErrors($response); + } + + public function testAddPointGroupScore(): void { $pointsToAdd = 5; $pointGroupApi = $this->getContext('pointGroups'); @@ -442,7 +479,7 @@ public function testAddPointGroupScore() $this->assertErrors($response); } - public function testSubtractPointGroupScore() + public function testSubtractPointGroupScore(): void { $pointsToSubtract = 3; $pointGroupApi = $this->getContext('pointGroups'); @@ -468,7 +505,7 @@ public function testSubtractPointGroupScore() $this->assertErrors($response); } - public function testMultiplyPointGroupScore() + public function testMultiplyPointGroupScore(): void { $multiplier = 2; $pointGroupApi = $this->getContext('pointGroups'); @@ -494,7 +531,7 @@ public function testMultiplyPointGroupScore() $this->assertErrors($response); } - public function testDividePointGroupScore() + public function testDividePointGroupScore(): void { $divisor = 4; $pointGroupApi = $this->getContext('pointGroups'); diff --git a/tests/Api/PointGroupsTest.php b/tests/Api/PointGroupsTest.php index 4ed480e..50541c5 100644 --- a/tests/Api/PointGroupsTest.php +++ b/tests/Api/PointGroupsTest.php @@ -1,12 +1,6 @@ standardTestGetList(); } - public function testGetListOfSpecificIds() + public function testGetListOfSpecificIds(): void { $this->standardTestGetListOfSpecificIds(); } - public function testCreateGetAndDelete() + public function testCreateGetAndDelete(): void { $this->standardTestCreateGetAndDelete(); } - public function testEditPatch() + public function testEditPatch(): void { $editTo = [ 'name' => 'Updated Point Group Name', @@ -44,12 +38,12 @@ public function testEditPatch() $this->standardTestEditPatch($editTo); } - public function testEditPut() + public function testEditPut(): void { $this->standardTestEditPut(); } - public function testBatchEndpoints() + public function testBatchEndpoints(): void { $this->standardTestBatchEndpoints(); } From d26c02d26e2e2e73bc3aa77d80405ce13562e570 Mon Sep 17 00:00:00 2001 From: Patryk Gruszka Date: Mon, 29 Apr 2024 14:28:59 +0200 Subject: [PATCH 5/6] fix: [DPMMA-2550] csfixer and fixed test --- tests/Api/ContactsTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Api/ContactsTest.php b/tests/Api/ContactsTest.php index f4d03d1..d0d5537 100644 --- a/tests/Api/ContactsTest.php +++ b/tests/Api/ContactsTest.php @@ -430,7 +430,7 @@ public function testGetPointGroupScores(): void $this->assertErrors($response); $this->assertSame(0, $response['total']); $this->assertIsArray($response['groupScores']); - $this->assertEmpty(0, $response['groupScores']); + $this->assertEmpty($response['groupScores']); // add score $pointsToAdd = 5; @@ -439,7 +439,7 @@ public function testGetPointGroupScores(): void $pointGroup = $response[$pointGroupApi->itemName()]; $response = $this->api->addPointGroupScore($contact['id'], $pointGroup['id'], $pointsToAdd); $this->assertErrors($response); - $this->assertNotEmpty($response['groupScore'], 'Adding point group score to a contact with ID =' . $contact['id'] . ' was not successful'); + $this->assertNotEmpty($response['groupScore'], 'Adding point group score to a contact with ID ='.$contact['id'].' was not successful'); // test get point group scores list $response = $this->api->getPointGroupScores($contact['id']); From 9b0639ecd5ef534bd662b1a622ef7ca067bafa04 Mon Sep 17 00:00:00 2001 From: Patryk Gruszka Date: Mon, 29 Apr 2024 14:37:40 +0200 Subject: [PATCH 6/6] fix: [DPMMA-2550] fixed test --- tests/Api/ContactsTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Api/ContactsTest.php b/tests/Api/ContactsTest.php index d0d5537..062f83a 100644 --- a/tests/Api/ContactsTest.php +++ b/tests/Api/ContactsTest.php @@ -450,7 +450,6 @@ public function testGetPointGroupScores(): void $this->assertSame(5, $response['groupScores'][0]['score']); $this->assertSame($pointGroup['id'], $response['groupScores'][0]['group']['id']); $this->assertSame($pointGroup['name'], $response['groupScores'][0]['group']['name']); - $this->assertSame($pointGroup['description'], $response['groupScores'][0]['group']['description']); $response = $this->api->delete($contact['id']); $this->assertErrors($response);