From 0fce4a49db6ffec02d786cbc00080f1bde7c5843 Mon Sep 17 00:00:00 2001 From: Uryvskiy Dima Date: Tue, 16 Jan 2024 23:47:15 +0300 Subject: [PATCH] Fix tests --- src/Model/Entity/Tasks/TaskComment.php | 4 +-- src/ResourceGroup/Tasks.php | 3 +- tests/src/ResourceGroup/TasksTest.php | 40 +++++++++++++------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/Model/Entity/Tasks/TaskComment.php b/src/Model/Entity/Tasks/TaskComment.php index ff163ec..6f9295b 100644 --- a/src/Model/Entity/Tasks/TaskComment.php +++ b/src/Model/Entity/Tasks/TaskComment.php @@ -3,8 +3,8 @@ /** * PHP version 7.3 * - * @category TaskHistory - * @package RetailCrm\Api\Model\Entity\TaskComment + * @category TaskComment + * @package RetailCrm\Api\Model\Entity\T */ namespace RetailCrm\Api\Model\Entity\Tasks; diff --git a/src/ResourceGroup/Tasks.php b/src/ResourceGroup/Tasks.php index 5d34bec..d9aaf42 100644 --- a/src/ResourceGroup/Tasks.php +++ b/src/ResourceGroup/Tasks.php @@ -283,7 +283,7 @@ class Tasks extends AbstractApiResourceGroup * $request->limit = 100; * $request->page = 1; * $request->filter = new TaskHistoryFilter(); - * $request->filter->sinceId = 1111; + * $request->filter->sinceId = 1; * * try { * $response = $client->tasks->history($request); @@ -326,6 +326,7 @@ class Tasks extends AbstractApiResourceGroup $request, TasksHistoryResponse::class ); + return $response; } } diff --git a/tests/src/ResourceGroup/TasksTest.php b/tests/src/ResourceGroup/TasksTest.php index 1863298..a21f10d 100644 --- a/tests/src/ResourceGroup/TasksTest.php +++ b/tests/src/ResourceGroup/TasksTest.php @@ -185,24 +185,24 @@ EOF; "success":true, "history":[ { - "id":1, - "createdAt":"2023-03-22 19:00:29", - "created":true, - "source":"rule", - "field":"id", - "oldValue":null, - "newValue":1, - "task":{ - "id":95978, - "text":"", - "commentary":"", - "createdAt":"2023-03-22 19:00:29", - "complete":false, - "performer":116, - "performerType":"user", + "id": 1, + "createdAt": "2023-03-22 19:00:29", + "created": true, + "source": "rule", + "field": "id", + "oldValue": null, + "newValue": 1, + "task": { + "id": 1, + "text": "", + "commentary": "", + "createdAt": "2023-03-22 19:00:29", + "complete": false, + "performer": 2, + "performerType": "user", "customer":{ - "type":"customer", - "id":1 + "type": "customer", + "id": 1 } } } @@ -210,9 +210,9 @@ EOF; } EOF; - $mock = static::createApiMockBuilder('tasks/1'); + $mock = static::createApiMockBuilder('tasks/history'); $mock->matchMethod(RequestMethod::GET) - ->reply(200) + ->reply() ->withBody($json); $client = TestClientFactory::createClient($mock->getClient()); @@ -225,6 +225,6 @@ EOF; $response = $client->tasks->history($request); - self::assertModelEqualsToResponse($json, $response); + self::assertModelEqualsToResponse($json, $response, true); } }